Compare commits
9 Commits
afa21f2fae
...
037bfab3ee
| Author | SHA1 | Date | |
|---|---|---|---|
| 037bfab3ee | |||
| 32dc25e4c3 | |||
| f9fd59d00e | |||
| 85a05f54ad | |||
| b0aa76760e | |||
| 58a2312529 | |||
| 927e564e90 | |||
| eeba2a0f5b | |||
| 847a34c6b9 |
File diff suppressed because it is too large
Load Diff
1220
config/neovim/config_nix.lua
Normal file
1220
config/neovim/config_nix.lua
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
INIT_PATH="$(readlink -f ~/.config/nvim/init.lua)"
|
INIT_PATH="$(readlink -f ~/.config/nvim/init.lua)"
|
||||||
cp -f "$INIT_PATH" ./config.lua
|
cp -f "$INIT_PATH" ./config.lua
|
||||||
echo "Copied $INIT_PATH to ./config.lua"
|
cp -f "$INIT_PATH" ./config_nix.lua
|
||||||
|
echo "Copied $INIT_PATH to ./config.lua and ./config_nix.lua"
|
||||||
|
|
||||||
chmod +w ./config.lua
|
chmod +w ./config.lua
|
||||||
echo "Fixed permission for ./config.lua"
|
chmod +w ./config_nix.lua
|
||||||
|
echo "Fixed permission for ./config.lua and ./config_nix.lua"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
rm -rf ./store/*
|
rm -rf ./store/*
|
||||||
|
|||||||
89
config/neovim/store/lazy-plugins/todo-comments.nvim/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
89
config/neovim/store/lazy-plugins/todo-comments.nvim/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: File a bug/issue
|
||||||
|
title: "bug: "
|
||||||
|
labels: [bug]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
**Before** reporting an issue, make sure to read the [documentation](https://github.com/folke/todo-comments.nvim) and search [existing issues](https://github.com/folke/todo-comments.nvim/issues). Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/todo-comments.nvim/discussions) and will be closed.
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Did you check docs and existing issues?
|
||||||
|
description: Make sure you checked all of the below before submitting an issue
|
||||||
|
options:
|
||||||
|
- label: I have read all the todo-comments.nvim docs
|
||||||
|
required: true
|
||||||
|
- label: I have searched the existing issues of todo-comments.nvim
|
||||||
|
required: true
|
||||||
|
- label: I have searched the existing issues of plugins related to this issue
|
||||||
|
required: true
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: "Neovim version (nvim -v)"
|
||||||
|
placeholder: "0.8.0 commit db1b0ee3b30f"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: "Operating system/version"
|
||||||
|
placeholder: "MacOS 11.5"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Describe the bug
|
||||||
|
description: A clear and concise description of what the bug is. Please include any related errors you see in Neovim.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Steps To Reproduce
|
||||||
|
description: Steps to reproduce the behavior.
|
||||||
|
placeholder: |
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Expected Behavior
|
||||||
|
description: A concise description of what you expected to happen.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Repro
|
||||||
|
description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua`
|
||||||
|
value: |
|
||||||
|
-- DO NOT change the paths and don't remove the colorscheme
|
||||||
|
local root = vim.fn.fnamemodify("./.repro", ":p")
|
||||||
|
|
||||||
|
-- set stdpaths to use .repro
|
||||||
|
for _, name in ipairs({ "config", "data", "state", "cache" }) do
|
||||||
|
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
|
||||||
|
end
|
||||||
|
|
||||||
|
-- bootstrap lazy
|
||||||
|
local lazypath = root .. "/plugins/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
|
||||||
|
end
|
||||||
|
vim.opt.runtimepath:prepend(lazypath)
|
||||||
|
|
||||||
|
-- install plugins
|
||||||
|
local plugins = {
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
-- add any other plugins here
|
||||||
|
}
|
||||||
|
require("lazy").setup(plugins, {
|
||||||
|
root = root .. "/plugins",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd.colorscheme("tokyonight")
|
||||||
|
-- add anything else here
|
||||||
|
render: Lua
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
36
config/neovim/store/lazy-plugins/todo-comments.nvim/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
36
config/neovim/store/lazy-plugins/todo-comments.nvim/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Feature Request
|
||||||
|
description: Suggest a new feature
|
||||||
|
title: "feature: "
|
||||||
|
labels: [enhancement]
|
||||||
|
body:
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Did you check the docs?
|
||||||
|
description: Make sure you read all the docs before submitting a feature request
|
||||||
|
options:
|
||||||
|
- label: I have read all the todo-comments.nvim docs
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Is your feature request related to a problem? Please describe.
|
||||||
|
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Describe the solution you'd like
|
||||||
|
description: A clear and concise description of what you want to happen.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Describe alternatives you've considered
|
||||||
|
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Add any other context or screenshots about the feature request here.
|
||||||
72
config/neovim/store/lazy-plugins/todo-comments.nvim/.github/workflows/ci.yml
vendored
Normal file
72
config/neovim/store/lazy-plugins/todo-comments.nvim/.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# os: [ubuntu-latest, windows-latest]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Install Neovim
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/nvim
|
||||||
|
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage
|
||||||
|
cd /tmp/nvim
|
||||||
|
chmod a+x ./nvim.appimage
|
||||||
|
./nvim.appimage --appimage-extract
|
||||||
|
echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
nvim --version
|
||||||
|
[ ! -d tests ] && exit 0
|
||||||
|
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}"
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: tests
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: panvimdoc
|
||||||
|
uses: kdheepak/panvimdoc@main
|
||||||
|
with:
|
||||||
|
vimdoc: todo-comments.nvim
|
||||||
|
version: "Neovim >= 0.8.0"
|
||||||
|
demojify: true
|
||||||
|
treesitter: true
|
||||||
|
- name: Push changes
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
commit_message: "chore(build): auto-generate vimdoc"
|
||||||
|
commit_user_name: "github-actions[bot]"
|
||||||
|
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||||
|
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||||
|
release:
|
||||||
|
name: release
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
needs:
|
||||||
|
- docs
|
||||||
|
- tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: google-github-actions/release-please-action@v3
|
||||||
|
id: release
|
||||||
|
with:
|
||||||
|
release-type: simple
|
||||||
|
package-name: todo-comments.nvim
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: tag stable versions
|
||||||
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
|
run: |
|
||||||
|
git config user.name github-actions[bot]
|
||||||
|
git config user.email github-actions[bot]@users.noreply.github.com
|
||||||
|
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
|
||||||
|
git tag -d stable || true
|
||||||
|
git push origin :stable || true
|
||||||
|
git tag -a stable -m "Last Stable Release"
|
||||||
|
git push origin stable
|
||||||
8
config/neovim/store/lazy-plugins/todo-comments.nvim/.gitignore
vendored
Normal file
8
config/neovim/store/lazy-plugins/todo-comments.nvim/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
tt.*
|
||||||
|
.tests
|
||||||
|
doc/tags
|
||||||
|
debug
|
||||||
|
.repro
|
||||||
|
foo.*
|
||||||
|
*.log
|
||||||
|
data
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
# https://github.com/Koihik/LuaFormatter/blob/master/docs/Style-Config.md
|
||||||
|
column_limit: 80
|
||||||
|
indent_width: 2
|
||||||
|
continuation_indent_width: 2
|
||||||
|
use_tab: false
|
||||||
|
chop_down_parameter: true
|
||||||
|
chop_down_table: true
|
||||||
|
chop_down_kv_table: true
|
||||||
|
single_quote_to_double_quote: true
|
||||||
|
spaces_inside_table_braces: true
|
||||||
|
align_parameter: true
|
||||||
|
keep_simple_control_block_one_line: true
|
||||||
|
extra_sep_at_table_end: true
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"neodev": {
|
||||||
|
"library": {
|
||||||
|
"plugins": [
|
||||||
|
"plenary.nvim",
|
||||||
|
"nvim-web-devicons",
|
||||||
|
"trouble.nvim"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lspconfig": {
|
||||||
|
"lua_ls": {
|
||||||
|
"Lua.runtime.version": "LuaJIT",
|
||||||
|
"Lua.workspace.checkThirdParty": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
128
config/neovim/store/lazy-plugins/todo-comments.nvim/CHANGELOG.md
Normal file
128
config/neovim/store/lazy-plugins/todo-comments.nvim/CHANGELOG.md
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [1.2.0](https://github.com/folke/todo-comments.nvim/compare/v1.1.0...v1.2.0) (2024-03-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* added source for trouble v3 ([9935ae9](https://github.com/folke/todo-comments.nvim/commit/9935ae96190c4c177cf0a0dfaddbe4a8addf3eed))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **trouble:** trouble v3 support ([3e45f2f](https://github.com/folke/todo-comments.nvim/commit/3e45f2fad81e7eca409280836620310b1267e1c7))
|
||||||
|
|
||||||
|
## [1.1.0](https://github.com/folke/todo-comments.nvim/compare/v1.0.1...v1.1.0) (2023-03-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **telescope:** access pickers with plugin_name... ([#191](https://github.com/folke/todo-comments.nvim/issues/191)) ([7420337](https://github.com/folke/todo-comments.nvim/commit/7420337c20d766e73eb83b5d17b4ef50331ed4cd))
|
||||||
|
|
||||||
|
## [1.0.1](https://github.com/folke/todo-comments.nvim/compare/v1.0.0...v1.0.1) (2023-03-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **icons:** fixed obsolete nerd font icons with nerdfix ([3bddf1d](https://github.com/folke/todo-comments.nvim/commit/3bddf1dc406b9212c881882c8cfc4798ee271762))
|
||||||
|
|
||||||
|
## 1.0.0 (2023-01-04)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* todo-comments now requires Neovim >= 0.8.0. Use the `neovim-pre-0.8.0` branch for older versions
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* accept argument to filter keywords ([#116](https://github.com/folke/todo-comments.nvim/issues/116)) ([67cd3a4](https://github.com/folke/todo-comments.nvim/commit/67cd3a4112f372bb1406dae35816d502f53a5af3))
|
||||||
|
* add config option to set gui style ([#117](https://github.com/folke/todo-comments.nvim/issues/117)) ([231888a](https://github.com/folke/todo-comments.nvim/commit/231888aa37ddbdcc8a58b06dcb19dacfa65bf2c7))
|
||||||
|
* add error logging for rg ([006250f](https://github.com/folke/todo-comments.nvim/commit/006250f11d34fdd4500db5fdde5133131b48bc72))
|
||||||
|
* add max line len option (Fixes [#33](https://github.com/folke/todo-comments.nvim/issues/33)) ([8b63dfc](https://github.com/folke/todo-comments.nvim/commit/8b63dfccf1ae11aeebc9fae3b3d7a6dd12bb09b5))
|
||||||
|
* added merge_keywords option that allows disabling the default groups ([3f3b8b4](https://github.com/folke/todo-comments.nvim/commit/3f3b8b4fa8b4b91c2a0142491ee22afd76c161e3))
|
||||||
|
* added methods to jump to next/prev todo comment ([c88d199](https://github.com/folke/todo-comments.nvim/commit/c88d1997e40cec2078562e405b52be863d60615a))
|
||||||
|
* added multiline context and pattern ([144cba6](https://github.com/folke/todo-comments.nvim/commit/144cba62f6753647a8c502b25475e5ed568d5358))
|
||||||
|
* added options.highlight.exclude. Fixes [#41](https://github.com/folke/todo-comments.nvim/issues/41) ([1275879](https://github.com/folke/todo-comments.nvim/commit/12758792a0d207b5a4a4fb5a11a0d321a4608108))
|
||||||
|
* added support for specifying multiple patterns for highlighting ([808a2e5](https://github.com/folke/todo-comments.nvim/commit/808a2e524b3720804716a99fd900986b9d727d4d))
|
||||||
|
* added TEST to ([5547b53](https://github.com/folke/todo-comments.nvim/commit/5547b537593a4322f876637c6ee2aa38b2ac50ee))
|
||||||
|
* added TodoLocList. Fixes [#47](https://github.com/folke/todo-comments.nvim/issues/47) ([c641728](https://github.com/folke/todo-comments.nvim/commit/c6417282c9d3948917e712b8e0b0093f9dc995e2))
|
||||||
|
* allow changing config on the fly or disable all [#27](https://github.com/folke/todo-comments.nvim/issues/27) ([2f701d0](https://github.com/folke/todo-comments.nvim/commit/2f701d0738e3b0dfae90c69435b752bbbaeb2ed3))
|
||||||
|
* allow custom todo patterns [#4](https://github.com/folke/todo-comments.nvim/issues/4) ([1732f21](https://github.com/folke/todo-comments.nvim/commit/1732f21854f0d7f9cffd6e92f9e95c13a01bd79e))
|
||||||
|
* allow searching for todos in another directory. Implements [#21](https://github.com/folke/todo-comments.nvim/issues/21) ([6de90a5](https://github.com/folke/todo-comments.nvim/commit/6de90a566ab50da6b76200a69486b6d51c8d07ee))
|
||||||
|
* allow specifying wide_fg ([#92](https://github.com/folke/todo-comments.nvim/issues/92)) ([dca8c3f](https://github.com/folke/todo-comments.nvim/commit/dca8c3fa3b515bc85652e50bf736d2cca8a87cb2))
|
||||||
|
* also deepcopy keywords ([0f6a87b](https://github.com/folke/todo-comments.nvim/commit/0f6a87bb04925775bb2fd68c063152512e033313))
|
||||||
|
* check if ripgrep is available and show error if not ([b5cdae7](https://github.com/folke/todo-comments.nvim/commit/b5cdae78f58ac23fcf4340013e4dc7197881196a))
|
||||||
|
* expose methods to jump to next/prev todo comment ([89ee420](https://github.com/folke/todo-comments.nvim/commit/89ee420be60750d074bcb95efa6f2159c0671950))
|
||||||
|
* Group search and highlight options ([fbf91af](https://github.com/folke/todo-comments.nvim/commit/fbf91af72193987e50e542c5148ffcca2ff89050))
|
||||||
|
* Improve rg and highlight pattern matching ([7a00efb](https://github.com/folke/todo-comments.nvim/commit/7a00efb6a6c585303d333b0c543c640aa888fb83))
|
||||||
|
* inital version ([7473917](https://github.com/folke/todo-comments.nvim/commit/747391791bbb67fafeb2e690f4688720392470c8))
|
||||||
|
* intergration with lsp trouble ([194e653](https://github.com/folke/todo-comments.nvim/commit/194e65323bb1e3d35075d7b3451db697f1ba75f8))
|
||||||
|
* make it possible to disable warnings when searching ([#63](https://github.com/folke/todo-comments.nvim/issues/63)) ([9983edc](https://github.com/folke/todo-comments.nvim/commit/9983edc5ef38c7a035c17c85f60ee13dbd75dcc8))
|
||||||
|
* make sign priority configurable ([edbe161](https://github.com/folke/todo-comments.nvim/commit/edbe161856eacc859987eaf28d41b67163d49791))
|
||||||
|
* multiline todo comments ([8dffc5d](https://github.com/folke/todo-comments.nvim/commit/8dffc5d3ed1495e70c05f5ca1d100f8d3a4c44aa))
|
||||||
|
* quickfix, telescope and trouble commands ([a7c12f2](https://github.com/folke/todo-comments.nvim/commit/a7c12f288c995a738688ec3a42e6a1f6d48f3b89))
|
||||||
|
* set default multiline pattern to `^.` ([8f00cdb](https://github.com/folke/todo-comments.nvim/commit/8f00cdbbeafdad95dc1da0d846d21d9eef2d510b))
|
||||||
|
* Telescope plugin ([95f04b1](https://github.com/folke/todo-comments.nvim/commit/95f04b1a1fc9b7a17731eebde4353697c5a01f9b))
|
||||||
|
* todo-comments now requires Neovim >= 0.8.0. Use the `neovim-pre-0.8.0` branch for older versions ([916cd4f](https://github.com/folke/todo-comments.nvim/commit/916cd4f144e7211874082286f7d5889018b5739d))
|
||||||
|
* use flame icon for hacks ([745df54](https://github.com/folke/todo-comments.nvim/commit/745df540153b0fc18b1ffec02c8875be1bf9e0c7))
|
||||||
|
* use treesitter to highlight keywords in comments only. If not a TS buffer, then highlight all comments [#22](https://github.com/folke/todo-comments.nvim/issues/22) ([b3fbe23](https://github.com/folke/todo-comments.nvim/commit/b3fbe23185189ba20ee0012bfbbb14e8fa55406e))
|
||||||
|
* use vim.notify instead of echo ([b745d75](https://github.com/folke/todo-comments.nvim/commit/b745d7513207eb8d809e1a92fae76e643310bf91))
|
||||||
|
* use vim.treesitter.get_captures_at_pos to detect comments ([6120afa](https://github.com/folke/todo-comments.nvim/commit/6120afa159d1dd3ba112ee4360b4ab4562a9b266))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add . to args for ripgrep to make it work on Windows ([03fc95a](https://github.com/folke/todo-comments.nvim/commit/03fc95a8f49edc8533a70577dedc44972733d88d))
|
||||||
|
* add proper error logging when ripgrep fails ([358b8c9](https://github.com/folke/todo-comments.nvim/commit/358b8c9c387557d21cbc14f8269e229467487954))
|
||||||
|
* allow highlighting in quickfix buffers ([f4d35a2](https://github.com/folke/todo-comments.nvim/commit/f4d35a2e5b601385b299bb44b1f556956d286292))
|
||||||
|
* avoid E5108 after pressing q: ([#111](https://github.com/folke/todo-comments.nvim/issues/111)) ([fb6f16b](https://github.com/folke/todo-comments.nvim/commit/fb6f16b89e475676d45bf6b39077fb752521e6f1))
|
||||||
|
* better keyword highlight pattern ([52d814d](https://github.com/folke/todo-comments.nvim/commit/52d814d7b5234e353d7599f566b1125d256633b9))
|
||||||
|
* check if buf is valid before clearing todo namespace ([23dfdaf](https://github.com/folke/todo-comments.nvim/commit/23dfdafe1990ae7b6c0f0c69a02736bb1a839219))
|
||||||
|
* check is current_win is still valid before setting it again ([37e7347](https://github.com/folke/todo-comments.nvim/commit/37e73472656d0642224dc86d9ce4784d8e4f5b5c))
|
||||||
|
* clear namespace with pcall to fix lazy loading weirdness. Fixes [#130](https://github.com/folke/todo-comments.nvim/issues/130) ([f990cd9](https://github.com/folke/todo-comments.nvim/commit/f990cd9c1d3e701f6746b523b71784ec2498ae35))
|
||||||
|
* debug code ([b09c700](https://github.com/folke/todo-comments.nvim/commit/b09c700ecf878092e91ed4b041c6eb7c840df994))
|
||||||
|
* defer highlight updates to prevent weird behavior of treesitter ([a4e433e](https://github.com/folke/todo-comments.nvim/commit/a4e433ee690455f94b4fba8fbc3241d061dc90f3))
|
||||||
|
* dont show signs for multiline comments ([3fe59db](https://github.com/folke/todo-comments.nvim/commit/3fe59db6dd6fb07857e0b9670a3b711104dfb53a))
|
||||||
|
* escape special characters in commentstring ([5fd5086](https://github.com/folke/todo-comments.nvim/commit/5fd5086a50f8bc012f50858805080c79ccb204bf))
|
||||||
|
* exit when buffer no longer exists ([3bc3bce](https://github.com/folke/todo-comments.nvim/commit/3bc3bceb4f1122028891830b2b408cd570e21859))
|
||||||
|
* fall back to syntax Comment if treesitter is not available ([b4dec37](https://github.com/folke/todo-comments.nvim/commit/b4dec37ba24c6c31d8129f601ff5db6cb4b9c99a))
|
||||||
|
* if todo is lazyloaded, then skip VimEnter ([564dc45](https://github.com/folke/todo-comments.nvim/commit/564dc4564cd47854f36e09e3d1910acb7e41e67d))
|
||||||
|
* improved comment support with treesitter ([219bc7e](https://github.com/folke/todo-comments.nvim/commit/219bc7ef4439b6fa53bc9db1dd14b11221e83d7d))
|
||||||
|
* is_comment now checks highlighter TS queries instead of parse tree ([d5f9bfc](https://github.com/folke/todo-comments.nvim/commit/d5f9bfc164c7ea306710d1a0a9d2db255387b1db))
|
||||||
|
* is_comment. Fixes [#145](https://github.com/folke/todo-comments.nvim/issues/145) ([1814fec](https://github.com/folke/todo-comments.nvim/commit/1814feca54540497de99d474dd6c9de6b691cf01))
|
||||||
|
* jumping to todo comments didnt use the correct line for is_comment checks ([c8c5446](https://github.com/folke/todo-comments.nvim/commit/c8c54465c74761ec95399584ed670700849ae401))
|
||||||
|
* keep previous options from setup ([8560546](https://github.com/folke/todo-comments.nvim/commit/8560546c466d1f555573d37e062e95e7ae94bbab))
|
||||||
|
* listen to treesitter changes to redo highlights ([9b276eb](https://github.com/folke/todo-comments.nvim/commit/9b276ebeeced9e15707c27e0b2588e7b3e19d9c5))
|
||||||
|
* matchstr fails with error about passing a dictionary as a string when string is binary [#23](https://github.com/folke/todo-comments.nvim/issues/23) ([ca2b794](https://github.com/folke/todo-comments.nvim/commit/ca2b7945e9bb58a5a8ab341b269028dd05d7ec61))
|
||||||
|
* never use comments to highlight quickfix buffers ([7a5e9c9](https://github.com/folke/todo-comments.nvim/commit/7a5e9c991670a834ed29951e58d29551f7a73fe3))
|
||||||
|
* pass kw start to is_comment. Fixes [#153](https://github.com/folke/todo-comments.nvim/issues/153) ([d3c6ec6](https://github.com/folke/todo-comments.nvim/commit/d3c6ec66caa07a31a16d3ed4b954a88742daa909))
|
||||||
|
* properly clear todo highlights in stop ([98b1ebf](https://github.com/folke/todo-comments.nvim/commit/98b1ebf198836bdc226c0562b9f906584e6c400e))
|
||||||
|
* properly escape commentstring [#19](https://github.com/folke/todo-comments.nvim/issues/19) ([a5c255c](https://github.com/folke/todo-comments.nvim/commit/a5c255c6860ae9456f339dc35586a6d47b6fd2cf))
|
||||||
|
* Properly pass options into jump function ([#143](https://github.com/folke/todo-comments.nvim/issues/143)) ([96391ae](https://github.com/folke/todo-comments.nvim/commit/96391ae41e63a5edba260adfd7312462b54ddc8e))
|
||||||
|
* re-apply highlights when treesitter bytes changes. Fixes [#134](https://github.com/folke/todo-comments.nvim/issues/134) ([e90b17e](https://github.com/folke/todo-comments.nvim/commit/e90b17e45c39f6f37994a2f0f60dde8472b8457d))
|
||||||
|
* remove FIX from alts for FIX ([e3b96b2](https://github.com/folke/todo-comments.nvim/commit/e3b96b253150c217a603fa11b79b90fcb2d1a649))
|
||||||
|
* remove set_current_win ([d2b9b26](https://github.com/folke/todo-comments.nvim/commit/d2b9b265ae250ac3c1737180095352080059d212))
|
||||||
|
* revert extmarks to add_highlight ([4a27e05](https://github.com/folke/todo-comments.nvim/commit/4a27e05519827ba1594d5ce3fde874040f005bfe))
|
||||||
|
* ripgrep gives exit code 2 on error. Exit code 1 means no results ([3ad4967](https://github.com/folke/todo-comments.nvim/commit/3ad4967972ed463ce1dfd38161ea98862b2bdffa))
|
||||||
|
* set fg_dark and fg_light to black and white for colorschemes that dont set Normal ([b64859a](https://github.com/folke/todo-comments.nvim/commit/b64859a2313472284fb0d29d9bc9e0108725ecc4))
|
||||||
|
* show error when running Todo without doing setup() ([f0cc7d3](https://github.com/folke/todo-comments.nvim/commit/f0cc7d3eb7c017c87c1ef52bf3f51d292971ef29))
|
||||||
|
* show warning message when no results were found ([09aa8de](https://github.com/folke/todo-comments.nvim/commit/09aa8de5ddb2483cafb955645bb4f98701736a98))
|
||||||
|
* skip possibly bad regex results ([014959e](https://github.com/folke/todo-comments.nvim/commit/014959e82aabc07a16739c771bf40e7fd6de3fe9))
|
||||||
|
* sort keywords by length in descending order ([#157](https://github.com/folke/todo-comments.nvim/issues/157)) ([2adb83e](https://github.com/folke/todo-comments.nvim/commit/2adb83e0fb082a5f1c40f3def4c8b18ec767c5ee))
|
||||||
|
* todo comments was broken for non treesitter files. Fixes [#150](https://github.com/folke/todo-comments.nvim/issues/150) ([f244aa3](https://github.com/folke/todo-comments.nvim/commit/f244aa391774b29878db580eff63a9e26dc5f084))
|
||||||
|
* Update docs ([2273076](https://github.com/folke/todo-comments.nvim/commit/2273076591b9ce78f562b52e3c0b4e34102f54a5))
|
||||||
|
* update README to 0.6 diagnostic hl ([#78](https://github.com/folke/todo-comments.nvim/issues/78)) ([672cd22](https://github.com/folke/todo-comments.nvim/commit/672cd22bd15928434374ac52d0cf38dd250231df))
|
||||||
|
* updated default colors to use 0.6 diagnostic highlights ([6570fd2](https://github.com/folke/todo-comments.nvim/commit/6570fd271d17fec1966522f3a19cc6f4c88824c4))
|
||||||
|
* use nvim_win_call instead of changing current window to apply highlights ([bff9e31](https://github.com/folke/todo-comments.nvim/commit/bff9e315ac3b5854a08d5a73b898822bdec1a5c3))
|
||||||
|
* use options.search.command for telescope ([ed24570](https://github.com/folke/todo-comments.nvim/commit/ed24570d07e0ffae9969006009a91ecabfff1493))
|
||||||
|
* use seperate hl group for signs using correct SignColumn bg color ([bf138df](https://github.com/folke/todo-comments.nvim/commit/bf138dff36602a1da40bbebabef8bae61735635c))
|
||||||
|
* use white as fg for color schemes that dont define a fg for Normal ([ec820ad](https://github.com/folke/todo-comments.nvim/commit/ec820ade091c28b221eb2f6d0ee02c554a61a8e8))
|
||||||
|
* When todo-comments.nvim as optional and report an error the first time you use it. ([#129](https://github.com/folke/todo-comments.nvim/issues/129)) ([5f90941](https://github.com/folke/todo-comments.nvim/commit/5f9094198563b693439837b593815dc18768fda8))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* defer settings up todo-comments ([5e84162](https://github.com/folke/todo-comments.nvim/commit/5e8416265a23c8b8b4711be73b465e6f6566f49b))
|
||||||
|
* defer setup to BufReadPre ++once ([455f49e](https://github.com/folke/todo-comments.nvim/commit/455f49e6e263fdd2fe1bfff2b1eb7c7457fbf68f))
|
||||||
|
* redraw was always doing the whole file! Fixes [#155](https://github.com/folke/todo-comments.nvim/issues/155) ([bca0e00](https://github.com/folke/todo-comments.nvim/commit/bca0e00644c22a3eecedce703c0db080dd6bdc55))
|
||||||
|
* throttle todo redraw calls. Fixes [#154](https://github.com/folke/todo-comments.nvim/issues/154) ([a9df434](https://github.com/folke/todo-comments.nvim/commit/a9df4342a564e9d95340f60a38a523fda27cdb2e))
|
||||||
201
config/neovim/store/lazy-plugins/todo-comments.nvim/LICENSE
Normal file
201
config/neovim/store/lazy-plugins/todo-comments.nvim/LICENSE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
187
config/neovim/store/lazy-plugins/todo-comments.nvim/README.md
Normal file
187
config/neovim/store/lazy-plugins/todo-comments.nvim/README.md
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
# ✅ Todo Comments
|
||||||
|
|
||||||
|
**todo-comments** is a lua plugin for Neovim >= 0.8.0 to highlight and search for todo comments like
|
||||||
|
`TODO`, `HACK`, `BUG` in your code base.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
- **highlight** your todo comments in different styles
|
||||||
|
- optionally only highlights todos in comments using **TreeSitter**
|
||||||
|
- configurable **signs**
|
||||||
|
- open todos in a **quickfix** list
|
||||||
|
- open todos in [Trouble](https://github.com/folke/trouble.nvim)
|
||||||
|
- search todos with [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
||||||
|
|
||||||
|
## ⚡️ Requirements
|
||||||
|
|
||||||
|
- Neovim >= 0.8.0 (use the `neovim-pre-0.8.0` branch for older versions)
|
||||||
|
- a [patched font](https://www.nerdfonts.com/) for the icons, or change them to simple ASCII characters
|
||||||
|
- optional:
|
||||||
|
- [ripgrep](https://github.com/BurntSushi/ripgrep) and [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) are used for searching.
|
||||||
|
- [Trouble](https://github.com/folke/trouble.nvim)
|
||||||
|
- [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
||||||
|
|
||||||
|
## 📦 Installation
|
||||||
|
|
||||||
|
Install the plugin with your preferred package manager:
|
||||||
|
|
||||||
|
### [lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## ⚙️ Configuration
|
||||||
|
|
||||||
|
Todo comes with the following defaults:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
signs = true, -- show icons in the signs column
|
||||||
|
sign_priority = 8, -- sign priority
|
||||||
|
-- keywords recognized as todo comments
|
||||||
|
keywords = {
|
||||||
|
FIX = {
|
||||||
|
icon = " ", -- icon used for the sign, and in search results
|
||||||
|
color = "error", -- can be a hex color, or a named color (see below)
|
||||||
|
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||||
|
-- signs = false, -- configure signs for some keywords individually
|
||||||
|
},
|
||||||
|
TODO = { icon = " ", color = "info" },
|
||||||
|
HACK = { icon = " ", color = "warning" },
|
||||||
|
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||||
|
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||||
|
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||||
|
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||||
|
},
|
||||||
|
gui_style = {
|
||||||
|
fg = "NONE", -- The gui style to use for the fg highlight group.
|
||||||
|
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
||||||
|
},
|
||||||
|
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||||
|
-- highlighting of the line containing the todo comment
|
||||||
|
-- * before: highlights before the keyword (typically comment characters)
|
||||||
|
-- * keyword: highlights of the keyword
|
||||||
|
-- * after: highlights after the keyword (todo text)
|
||||||
|
highlight = {
|
||||||
|
multiline = true, -- enable multine todo comments
|
||||||
|
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
|
||||||
|
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
|
||||||
|
before = "", -- "fg" or "bg" or empty
|
||||||
|
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
|
||||||
|
after = "fg", -- "fg" or "bg" or empty
|
||||||
|
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
|
||||||
|
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||||
|
max_line_len = 400, -- ignore lines longer than this
|
||||||
|
exclude = {}, -- list of file types to exclude highlighting
|
||||||
|
},
|
||||||
|
-- list of named colors where we try to extract the guifg from the
|
||||||
|
-- list of highlight groups or use the hex color if hl not found as a fallback
|
||||||
|
colors = {
|
||||||
|
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||||
|
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||||
|
info = { "DiagnosticInfo", "#2563EB" },
|
||||||
|
hint = { "DiagnosticHint", "#10B981" },
|
||||||
|
default = { "Identifier", "#7C3AED" },
|
||||||
|
test = { "Identifier", "#FF00FF" }
|
||||||
|
},
|
||||||
|
search = {
|
||||||
|
command = "rg",
|
||||||
|
args = {
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
},
|
||||||
|
-- regex that will be used to match keywords.
|
||||||
|
-- don't replace the (KEYWORDS) placeholder
|
||||||
|
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
||||||
|
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Jumping
|
||||||
|
|
||||||
|
Two methods are available to jump to the next/previous todo comment.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
vim.keymap.set("n", "]t", function()
|
||||||
|
require("todo-comments").jump_next()
|
||||||
|
end, { desc = "Next todo comment" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "[t", function()
|
||||||
|
require("todo-comments").jump_prev()
|
||||||
|
end, { desc = "Previous todo comment" })
|
||||||
|
|
||||||
|
-- You can also specify a list of valid jump keywords
|
||||||
|
|
||||||
|
vim.keymap.set("n", "]t", function()
|
||||||
|
require("todo-comments").jump_next({keywords = { "ERROR", "WARNING" }})
|
||||||
|
end, { desc = "Next error/warning todo comment" })
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🚀 Usage
|
||||||
|
|
||||||
|
**Todo** matches on any text that starts with one of your defined keywords (or alt) followed by a colon:
|
||||||
|
|
||||||
|
- TODO: do something
|
||||||
|
- FIX: this should be fixed
|
||||||
|
- HACK: weird code warning
|
||||||
|
|
||||||
|
Todos are highlighted in all regular files.
|
||||||
|
|
||||||
|
Each of the commands below accept the following arguments:
|
||||||
|
|
||||||
|
- `cwd` - Specify the directory to search for comments, like:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:TodoTrouble cwd=~/projects/foobar
|
||||||
|
```
|
||||||
|
|
||||||
|
- `keywords` - Comma separated list of keywords to filter results by. Keywords are case-sensitive.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:TodoTelescope keywords=TODO,FIX
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🔎 `:TodoQuickFix`
|
||||||
|
|
||||||
|
This uses the quickfix list to show all todos in your project.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 🔎 `:TodoLocList`
|
||||||
|
|
||||||
|
This uses the location list to show all todos in your project.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 🚦 `:TodoTrouble`
|
||||||
|
|
||||||
|
List all project todos in [trouble](https://github.com/folke/trouble.nvim)
|
||||||
|
|
||||||
|
> See screenshot at the top
|
||||||
|
|
||||||
|
### 🔭 `:TodoTelescope`
|
||||||
|
|
||||||
|
Search through all project todos with Telescope
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
<!-- markdownlint-disable-file MD033 -->
|
||||||
|
<!-- markdownlint-configure-file { "MD013": { "line_length": 120 } } -->
|
||||||
|
<!-- markdownlint-configure-file { "MD004": { "style": "sublist" } } -->
|
||||||
@ -0,0 +1,211 @@
|
|||||||
|
*todo-comments.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 May 22
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Table of Contents *todo-comments.nvim-table-of-contents*
|
||||||
|
|
||||||
|
1. Todo Comments |todo-comments.nvim-todo-comments|
|
||||||
|
- Features |todo-comments.nvim-todo-comments-features|
|
||||||
|
- Requirements |todo-comments.nvim-todo-comments-requirements|
|
||||||
|
- Installation |todo-comments.nvim-todo-comments-installation|
|
||||||
|
- Configuration |todo-comments.nvim-todo-comments-configuration|
|
||||||
|
- Usage |todo-comments.nvim-todo-comments-usage|
|
||||||
|
2. Links |todo-comments.nvim-links|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
1. Todo Comments *todo-comments.nvim-todo-comments*
|
||||||
|
|
||||||
|
**todo-comments** is a lua plugin for Neovim >= 0.8.0 to highlight and search
|
||||||
|
for todo comments like `TODO`, `HACK`, `BUG` in your code base.
|
||||||
|
|
||||||
|
|
||||||
|
FEATURES *todo-comments.nvim-todo-comments-features*
|
||||||
|
|
||||||
|
- **highlight** your todo comments in different styles
|
||||||
|
- optionally only highlights todos in comments using **TreeSitter**
|
||||||
|
- configurable **signs**
|
||||||
|
- open todos in a **quickfix** list
|
||||||
|
- open todos in Trouble <https://github.com/folke/trouble.nvim>
|
||||||
|
- search todos with Telescope <https://github.com/nvim-telescope/telescope.nvim>
|
||||||
|
|
||||||
|
|
||||||
|
REQUIREMENTS *todo-comments.nvim-todo-comments-requirements*
|
||||||
|
|
||||||
|
- Neovim >= 0.8.0 (use the `neovim-pre-0.8.0` branch for older versions)
|
||||||
|
- a patched font <https://www.nerdfonts.com/> for the icons, or change them to simple ASCII characters
|
||||||
|
- optional:
|
||||||
|
- ripgrep <https://github.com/BurntSushi/ripgrep> and plenary.nvim <https://github.com/nvim-lua/plenary.nvim> are used for searching.
|
||||||
|
- Trouble <https://github.com/folke/trouble.nvim>
|
||||||
|
- Telescope <https://github.com/nvim-telescope/telescope.nvim>
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLATION *todo-comments.nvim-todo-comments-installation*
|
||||||
|
|
||||||
|
Install the plugin with your preferred package manager:
|
||||||
|
|
||||||
|
|
||||||
|
LAZY.NVIM ~
|
||||||
|
|
||||||
|
>lua
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
CONFIGURATION *todo-comments.nvim-todo-comments-configuration*
|
||||||
|
|
||||||
|
Todo comes with the following defaults:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
{
|
||||||
|
signs = true, -- show icons in the signs column
|
||||||
|
sign_priority = 8, -- sign priority
|
||||||
|
-- keywords recognized as todo comments
|
||||||
|
keywords = {
|
||||||
|
FIX = {
|
||||||
|
icon = " ", -- icon used for the sign, and in search results
|
||||||
|
color = "error", -- can be a hex color, or a named color (see below)
|
||||||
|
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||||
|
-- signs = false, -- configure signs for some keywords individually
|
||||||
|
},
|
||||||
|
TODO = { icon = " ", color = "info" },
|
||||||
|
HACK = { icon = " ", color = "warning" },
|
||||||
|
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||||
|
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||||
|
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||||
|
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||||
|
},
|
||||||
|
gui_style = {
|
||||||
|
fg = "NONE", -- The gui style to use for the fg highlight group.
|
||||||
|
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
||||||
|
},
|
||||||
|
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||||
|
-- highlighting of the line containing the todo comment
|
||||||
|
-- * before: highlights before the keyword (typically comment characters)
|
||||||
|
-- * keyword: highlights of the keyword
|
||||||
|
-- * after: highlights after the keyword (todo text)
|
||||||
|
highlight = {
|
||||||
|
multiline = true, -- enable multine todo comments
|
||||||
|
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
|
||||||
|
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
|
||||||
|
before = "", -- "fg" or "bg" or empty
|
||||||
|
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
|
||||||
|
after = "fg", -- "fg" or "bg" or empty
|
||||||
|
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
|
||||||
|
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||||
|
max_line_len = 400, -- ignore lines longer than this
|
||||||
|
exclude = {}, -- list of file types to exclude highlighting
|
||||||
|
},
|
||||||
|
-- list of named colors where we try to extract the guifg from the
|
||||||
|
-- list of highlight groups or use the hex color if hl not found as a fallback
|
||||||
|
colors = {
|
||||||
|
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||||
|
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||||
|
info = { "DiagnosticInfo", "#2563EB" },
|
||||||
|
hint = { "DiagnosticHint", "#10B981" },
|
||||||
|
default = { "Identifier", "#7C3AED" },
|
||||||
|
test = { "Identifier", "#FF00FF" }
|
||||||
|
},
|
||||||
|
search = {
|
||||||
|
command = "rg",
|
||||||
|
args = {
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
},
|
||||||
|
-- regex that will be used to match keywords.
|
||||||
|
-- don't replace the (KEYWORDS) placeholder
|
||||||
|
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
||||||
|
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
|
||||||
|
},
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
JUMPING ~
|
||||||
|
|
||||||
|
Two methods are available to jump to the next/previous todo comment.
|
||||||
|
|
||||||
|
>lua
|
||||||
|
vim.keymap.set("n", "]t", function()
|
||||||
|
require("todo-comments").jump_next()
|
||||||
|
end, { desc = "Next todo comment" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "[t", function()
|
||||||
|
require("todo-comments").jump_prev()
|
||||||
|
end, { desc = "Previous todo comment" })
|
||||||
|
|
||||||
|
-- You can also specify a list of valid jump keywords
|
||||||
|
|
||||||
|
vim.keymap.set("n", "]t", function()
|
||||||
|
require("todo-comments").jump_next({keywords = { "ERROR", "WARNING" }})
|
||||||
|
end, { desc = "Next error/warning todo comment" })
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
USAGE *todo-comments.nvim-todo-comments-usage*
|
||||||
|
|
||||||
|
**Todo** matches on any text that starts with one of your defined keywords (or
|
||||||
|
alt) followed by a colon:
|
||||||
|
|
||||||
|
- TODO: do something
|
||||||
|
- FIX: this should be fixed
|
||||||
|
- HACK: weird code warning
|
||||||
|
|
||||||
|
Todos are highlighted in all regular files.
|
||||||
|
|
||||||
|
Each of the commands below accept the following arguments:
|
||||||
|
|
||||||
|
- `cwd` - Specify the directory to search for comments, like:
|
||||||
|
|
||||||
|
>vim
|
||||||
|
:TodoTrouble cwd=~/projects/foobar
|
||||||
|
<
|
||||||
|
|
||||||
|
- `keywords` - Comma separated list of keywords to filter results by. Keywords are case-sensitive.
|
||||||
|
|
||||||
|
>vim
|
||||||
|
:TodoTelescope keywords=TODO,FIX
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
:TODOQUICKFIX ~
|
||||||
|
|
||||||
|
This uses the quickfix list to show all todos in your project.
|
||||||
|
|
||||||
|
|
||||||
|
:TODOLOCLIST ~
|
||||||
|
|
||||||
|
This uses the location list to show all todos in your project.
|
||||||
|
|
||||||
|
|
||||||
|
:TODOTROUBLE ~
|
||||||
|
|
||||||
|
List all project todos in trouble <https://github.com/folke/trouble.nvim>
|
||||||
|
|
||||||
|
|
||||||
|
See screenshot at the top
|
||||||
|
|
||||||
|
:TODOTELESCOPE ~
|
||||||
|
|
||||||
|
Search through all project todos with Telescope
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
2. Links *todo-comments.nvim-links*
|
||||||
|
|
||||||
|
1. *image*: https://user-images.githubusercontent.com/292349/118135272-ad21e980-b3b7-11eb-881c-e45a4a3d6192.png
|
||||||
|
2. *image*: https://user-images.githubusercontent.com/292349/118135332-bf9c2300-b3b7-11eb-9a40-1307feb27c44.png
|
||||||
|
3. *image*: https://user-images.githubusercontent.com/292349/118135332-bf9c2300-b3b7-11eb-9a40-1307feb27c44.png
|
||||||
|
4. *image*: https://user-images.githubusercontent.com/292349/118135371-ccb91200-b3b7-11eb-9002-66af3b683cf0.png
|
||||||
|
|
||||||
|
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
|
||||||
|
|
||||||
|
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
local has_telescope, telescope = pcall(require, "telescope")
|
||||||
|
|
||||||
|
if not has_telescope then
|
||||||
|
error("This plugins requires nvim-telescope/telescope.nvim")
|
||||||
|
end
|
||||||
|
|
||||||
|
local pickers = require("telescope.builtin")
|
||||||
|
local Config = require("todo-comments.config")
|
||||||
|
local Highlight = require("todo-comments.highlight")
|
||||||
|
local make_entry = require("telescope.make_entry")
|
||||||
|
|
||||||
|
local function keywords_filter(opts_keywords)
|
||||||
|
assert(not opts_keywords or type(opts_keywords) == "string", "'keywords' must be a comma separated string or nil")
|
||||||
|
local all_keywords = vim.tbl_keys(Config.keywords)
|
||||||
|
if not opts_keywords then
|
||||||
|
return all_keywords
|
||||||
|
end
|
||||||
|
local filters = vim.split(opts_keywords, ",")
|
||||||
|
return vim.tbl_filter(function(kw)
|
||||||
|
return vim.tbl_contains(filters, kw)
|
||||||
|
end, all_keywords)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function todo(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.vimgrep_arguments = { Config.options.search.command }
|
||||||
|
vim.list_extend(opts.vimgrep_arguments, Config.options.search.args)
|
||||||
|
|
||||||
|
opts.search = Config.search_regex(keywords_filter(opts.keywords))
|
||||||
|
opts.prompt_title = "Find Todo"
|
||||||
|
opts.use_regex = true
|
||||||
|
local entry_maker = make_entry.gen_from_vimgrep(opts)
|
||||||
|
opts.entry_maker = function(line)
|
||||||
|
local ret = entry_maker(line)
|
||||||
|
ret.display = function(entry)
|
||||||
|
local display = string.format("%s:%s:%s ", entry.filename, entry.lnum, entry.col)
|
||||||
|
local text = entry.text
|
||||||
|
local start, finish, kw = Highlight.match(text)
|
||||||
|
|
||||||
|
local hl = {}
|
||||||
|
|
||||||
|
if start then
|
||||||
|
kw = Config.keywords[kw] or kw
|
||||||
|
local icon = Config.options.keywords[kw].icon
|
||||||
|
display = icon .. " " .. display
|
||||||
|
table.insert(hl, { { 1, #icon + 1 }, "TodoFg" .. kw })
|
||||||
|
text = vim.trim(text:sub(start))
|
||||||
|
|
||||||
|
table.insert(hl, {
|
||||||
|
{ #display, #display + finish - start + 2 },
|
||||||
|
"TodoBg" .. kw,
|
||||||
|
})
|
||||||
|
table.insert(hl, {
|
||||||
|
{ #display + finish - start + 1, #display + finish + 1 + #text },
|
||||||
|
"TodoFg" .. kw,
|
||||||
|
})
|
||||||
|
display = display .. " " .. text
|
||||||
|
end
|
||||||
|
|
||||||
|
return display, hl
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
pickers.grep_string(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return telescope.register_extension({ exports = { ["todo-comments"] = todo, todo = todo } })
|
||||||
@ -0,0 +1,193 @@
|
|||||||
|
local Util = require("todo-comments.util")
|
||||||
|
|
||||||
|
--- @class TodoConfig
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.keywords = {}
|
||||||
|
--- @type TodoOptions
|
||||||
|
M.options = {}
|
||||||
|
M.loaded = false
|
||||||
|
|
||||||
|
M.ns = vim.api.nvim_create_namespace("todo-comments")
|
||||||
|
|
||||||
|
--- @class TodoOptions
|
||||||
|
-- TODO: add support for markdown todos
|
||||||
|
local defaults = {
|
||||||
|
signs = true, -- show icons in the signs column
|
||||||
|
sign_priority = 8, -- sign priority
|
||||||
|
-- keywords recognized as todo comments
|
||||||
|
keywords = {
|
||||||
|
FIX = {
|
||||||
|
icon = " ", -- icon used for the sign, and in search results
|
||||||
|
color = "error", -- can be a hex color, or a named color (see below)
|
||||||
|
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||||
|
-- signs = false, -- configure signs for some keywords individually
|
||||||
|
},
|
||||||
|
TODO = { icon = " ", color = "info" },
|
||||||
|
HACK = { icon = " ", color = "warning" },
|
||||||
|
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||||
|
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||||
|
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||||
|
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||||
|
},
|
||||||
|
gui_style = {
|
||||||
|
fg = "NONE", -- The gui style to use for the fg highlight group.
|
||||||
|
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
||||||
|
},
|
||||||
|
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||||
|
-- highlighting of the line containing the todo comment
|
||||||
|
-- * before: highlights before the keyword (typically comment characters)
|
||||||
|
-- * keyword: highlights of the keyword
|
||||||
|
-- * after: highlights after the keyword (todo text)
|
||||||
|
highlight = {
|
||||||
|
multiline = true, -- enable multine todo comments
|
||||||
|
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
|
||||||
|
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
|
||||||
|
before = "", -- "fg" or "bg" or empty
|
||||||
|
keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
|
||||||
|
after = "fg", -- "fg" or "bg" or empty
|
||||||
|
-- pattern can be a string, or a table of regexes that will be checked
|
||||||
|
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlightng (vim regex)
|
||||||
|
-- pattern = { [[.*<(KEYWORDS)\s*:]], [[.*\@(KEYWORDS)\s*]] }, -- pattern used for highlightng (vim regex)
|
||||||
|
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||||
|
max_line_len = 400, -- ignore lines longer than this
|
||||||
|
exclude = {}, -- list of file types to exclude highlighting
|
||||||
|
throttle = 200,
|
||||||
|
},
|
||||||
|
-- list of named colors where we try to extract the guifg from the
|
||||||
|
-- list of hilight groups or use the hex color if hl not found as a fallback
|
||||||
|
colors = {
|
||||||
|
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||||
|
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||||
|
info = { "DiagnosticInfo", "#2563EB" },
|
||||||
|
hint = { "DiagnosticHint", "#10B981" },
|
||||||
|
default = { "Identifier", "#7C3AED" },
|
||||||
|
test = { "Identifier", "#FF00FF" },
|
||||||
|
},
|
||||||
|
search = {
|
||||||
|
command = "rg",
|
||||||
|
args = {
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
},
|
||||||
|
-- regex that will be used to match keywords.
|
||||||
|
-- don't replace the (KEYWORDS) placeholder
|
||||||
|
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
||||||
|
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
M._options = nil
|
||||||
|
|
||||||
|
function M.setup(options)
|
||||||
|
if vim.fn.has("nvim-0.8.0") == 0 then
|
||||||
|
error("todo-comments needs Neovim >= 0.8.0. Use the 'neovim-pre-0.8.0' branch for older versions")
|
||||||
|
end
|
||||||
|
M._options = options
|
||||||
|
if vim.api.nvim_get_vvar("vim_did_enter") == 0 then
|
||||||
|
vim.defer_fn(function()
|
||||||
|
M._setup()
|
||||||
|
end, 0)
|
||||||
|
else
|
||||||
|
M._setup()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M._setup()
|
||||||
|
M.options = vim.tbl_deep_extend("force", {}, defaults, M.options or {}, M._options or {})
|
||||||
|
|
||||||
|
-- -- keywords should always be fully overriden
|
||||||
|
if M._options and M._options.keywords and M._options.merge_keywords == false then
|
||||||
|
M.options.keywords = M._options.keywords
|
||||||
|
end
|
||||||
|
|
||||||
|
for kw, opts in pairs(M.options.keywords) do
|
||||||
|
M.keywords[kw] = kw
|
||||||
|
for _, alt in pairs(opts.alt or {}) do
|
||||||
|
M.keywords[alt] = kw
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function tags(keywords)
|
||||||
|
local kws = keywords or vim.tbl_keys(M.keywords)
|
||||||
|
table.sort(kws, function(a, b)
|
||||||
|
return #b < #a
|
||||||
|
end)
|
||||||
|
return table.concat(kws, "|")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.search_regex(keywords)
|
||||||
|
return M.options.search.pattern:gsub("KEYWORDS", tags(keywords))
|
||||||
|
end
|
||||||
|
|
||||||
|
M.hl_regex = {}
|
||||||
|
local patterns = M.options.highlight.pattern
|
||||||
|
patterns = type(patterns) == "table" and patterns or { patterns }
|
||||||
|
for _, p in pairs(patterns) do
|
||||||
|
p = p:gsub("KEYWORDS", tags())
|
||||||
|
table.insert(M.hl_regex, p)
|
||||||
|
end
|
||||||
|
M.colors()
|
||||||
|
M.signs()
|
||||||
|
require("todo-comments.highlight").start()
|
||||||
|
M.loaded = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.signs()
|
||||||
|
for kw, opts in pairs(M.options.keywords) do
|
||||||
|
vim.fn.sign_define("todo-sign-" .. kw, {
|
||||||
|
text = opts.icon,
|
||||||
|
texthl = "TodoSign" .. kw,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.colors()
|
||||||
|
local normal = Util.get_hl("Normal")
|
||||||
|
local fg_dark = Util.is_dark(normal.foreground or "#ffffff") and normal.foreground or normal.background
|
||||||
|
local fg_light = Util.is_dark(normal.foreground or "#ffffff") and normal.background or normal.foreground
|
||||||
|
fg_dark = fg_dark or "#000000"
|
||||||
|
fg_light = fg_light or "#ffffff"
|
||||||
|
local fg_gui = M.options.gui_style.fg
|
||||||
|
local bg_gui = M.options.gui_style.bg
|
||||||
|
|
||||||
|
local sign_hl = Util.get_hl("SignColumn")
|
||||||
|
local sign_bg = (sign_hl and sign_hl.background) and sign_hl.background or "NONE"
|
||||||
|
|
||||||
|
for kw, opts in pairs(M.options.keywords) do
|
||||||
|
local kw_color = opts.color or "default"
|
||||||
|
local hex
|
||||||
|
|
||||||
|
if kw_color:sub(1, 1) == "#" then
|
||||||
|
hex = kw_color
|
||||||
|
else
|
||||||
|
local colors = M.options.colors[kw_color]
|
||||||
|
colors = type(colors) == "string" and { colors } or colors
|
||||||
|
|
||||||
|
for _, color in pairs(colors) do
|
||||||
|
if color:sub(1, 1) == "#" then
|
||||||
|
hex = color
|
||||||
|
break
|
||||||
|
end
|
||||||
|
local c = Util.get_hl(color)
|
||||||
|
if c and c.foreground then
|
||||||
|
hex = c.foreground
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not hex then
|
||||||
|
error("Todo: no color for " .. kw)
|
||||||
|
end
|
||||||
|
local fg = Util.is_dark(hex) and fg_light or fg_dark
|
||||||
|
|
||||||
|
vim.cmd("hi def TodoBg" .. kw .. " guibg=" .. hex .. " guifg=" .. fg .. " gui=" .. bg_gui)
|
||||||
|
vim.cmd("hi def TodoFg" .. kw .. " guibg=NONE guifg=" .. hex .. " gui=" .. fg_gui)
|
||||||
|
vim.cmd("hi def TodoSign" .. kw .. " guibg=" .. sign_bg .. " guifg=" .. hex .. " gui=NONE")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@ -0,0 +1,403 @@
|
|||||||
|
-- FIX: dddddd
|
||||||
|
-- TODO: foobar
|
||||||
|
-- dddddd
|
||||||
|
local Config = require("todo-comments.config")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
M.enabled = false
|
||||||
|
M.bufs = {}
|
||||||
|
M.wins = {}
|
||||||
|
|
||||||
|
-- PERF: fully optimised
|
||||||
|
-- FIX: ddddddasdasdasdasdasda
|
||||||
|
-- PERF: dddd
|
||||||
|
-- ddddd
|
||||||
|
-- dddddd
|
||||||
|
-- ddddddd
|
||||||
|
-- FIXME: dddddd
|
||||||
|
-- FIX: ddd
|
||||||
|
-- HACK: hmmm, this looks a bit funky
|
||||||
|
-- TODO: What else?
|
||||||
|
-- NOTE: adding a note
|
||||||
|
--
|
||||||
|
-- FIX: this needs fixing
|
||||||
|
-- WARNING: ???
|
||||||
|
-- FIX: ddddd
|
||||||
|
-- continuation
|
||||||
|
-- @TODO foobar
|
||||||
|
-- @hack foobar
|
||||||
|
|
||||||
|
---@alias TodoDirty table<number, boolean>
|
||||||
|
---@type table<buffer, {dirty:TodoDirty}>
|
||||||
|
M.state = {}
|
||||||
|
|
||||||
|
function M.match(str, patterns)
|
||||||
|
local max_line_len = Config.options.highlight.max_line_len
|
||||||
|
|
||||||
|
if max_line_len and #str > max_line_len then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
patterns = patterns or Config.hl_regex
|
||||||
|
if not type(patterns) == "table" then
|
||||||
|
patterns = { patterns }
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, pattern in pairs(patterns) do
|
||||||
|
local m = vim.fn.matchlist(str, [[\v\C]] .. pattern)
|
||||||
|
if #m > 1 and m[2] then
|
||||||
|
local kw = m[2]
|
||||||
|
local start = str:find(kw)
|
||||||
|
return start, start + #kw, kw
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This method returns nil if this buf doesn't have a treesitter parser
|
||||||
|
--- @return boolean? true or false otherwise
|
||||||
|
function M.is_comment(buf, row, col)
|
||||||
|
if vim.treesitter.highlighter.active[buf] then
|
||||||
|
local captures = vim.treesitter.get_captures_at_pos(buf, row, col)
|
||||||
|
for _, c in ipairs(captures) do
|
||||||
|
if c.capture == "comment" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local win = vim.fn.bufwinid(buf)
|
||||||
|
return win ~= -1
|
||||||
|
and vim.api.nvim_win_call(win, function()
|
||||||
|
for _, i1 in ipairs(vim.fn.synstack(row + 1, col)) do
|
||||||
|
local i2 = vim.fn.synIDtrans(i1)
|
||||||
|
local n1 = vim.fn.synIDattr(i1, "name")
|
||||||
|
local n2 = vim.fn.synIDattr(i2, "name")
|
||||||
|
if n1 == "Comment" or n2 == "Comment" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function add_highlight(buffer, ns, hl, line, from, to)
|
||||||
|
-- vim.api.nvim_buf_set_extmark(buffer, ns, line, from, {
|
||||||
|
-- end_line = line,
|
||||||
|
-- end_col = to,
|
||||||
|
-- hl_group = hl,
|
||||||
|
-- priority = 500,
|
||||||
|
-- })
|
||||||
|
vim.api.nvim_buf_add_highlight(buffer, ns, hl, line, from, to)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_state(buf)
|
||||||
|
if not M.state[buf] then
|
||||||
|
M.state[buf] = { dirty = {}, comments = {} }
|
||||||
|
end
|
||||||
|
return M.state[buf]
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.redraw(buf, first, last)
|
||||||
|
first = math.max(first - Config.options.highlight.multiline_context, 0)
|
||||||
|
last = math.min(last + Config.options.highlight.multiline_context, vim.api.nvim_buf_line_count(buf))
|
||||||
|
local state = M.get_state(buf)
|
||||||
|
for i = first, last do
|
||||||
|
state.dirty[i] = true
|
||||||
|
end
|
||||||
|
if not M.timer then
|
||||||
|
M.timer = vim.defer_fn(M.update, Config.options.highlight.throttle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type vim.loop.Timer
|
||||||
|
M.timer = nil
|
||||||
|
|
||||||
|
function M.update()
|
||||||
|
M.timer = nil
|
||||||
|
for buf, state in pairs(M.state) do
|
||||||
|
if vim.api.nvim_buf_is_valid(buf) then
|
||||||
|
if not vim.tbl_isempty(state.dirty) then
|
||||||
|
local dirty = vim.tbl_keys(state.dirty)
|
||||||
|
table.sort(dirty)
|
||||||
|
|
||||||
|
local i = 1
|
||||||
|
while i <= #dirty do
|
||||||
|
local first = dirty[i]
|
||||||
|
local last = dirty[i]
|
||||||
|
while dirty[i + 1] == dirty[i] + 1 do
|
||||||
|
i = i + 1
|
||||||
|
last = dirty[i]
|
||||||
|
end
|
||||||
|
M.highlight(buf, first, last)
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
state.dirty = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
M.state[buf] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- highlights the range for the given buf
|
||||||
|
function M.highlight(buf, first, last, _event)
|
||||||
|
if not vim.api.nvim_buf_is_valid(buf) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_buf_clear_namespace(buf, Config.ns, first, last + 1)
|
||||||
|
|
||||||
|
-- clear signs
|
||||||
|
for _, sign in pairs(vim.fn.sign_getplaced(buf, { group = "todo-signs" })[1].signs) do
|
||||||
|
if sign.lnum - 1 >= first and sign.lnum - 1 <= last then
|
||||||
|
vim.fn.sign_unplace("todo-signs", { buffer = buf, id = sign.id })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(buf, first, last + 1, false)
|
||||||
|
|
||||||
|
---@type {kw: string, start:integer}?
|
||||||
|
local last_match
|
||||||
|
|
||||||
|
for l, line in ipairs(lines) do
|
||||||
|
local ok, start, finish, kw = pcall(M.match, line)
|
||||||
|
local lnum = first + l - 1
|
||||||
|
|
||||||
|
if ok and start then
|
||||||
|
---@cast kw string
|
||||||
|
if
|
||||||
|
Config.options.highlight.comments_only
|
||||||
|
and not M.is_quickfix(buf)
|
||||||
|
and not M.is_comment(buf, lnum, start - 1)
|
||||||
|
then
|
||||||
|
kw = nil
|
||||||
|
else
|
||||||
|
last_match = { kw = kw, start = start }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local is_multiline = false
|
||||||
|
|
||||||
|
if not kw and last_match and Config.options.highlight.multiline then
|
||||||
|
if
|
||||||
|
M.is_comment(buf, lnum, last_match.start)
|
||||||
|
and line:find(Config.options.highlight.multiline_pattern, last_match.start)
|
||||||
|
then
|
||||||
|
kw = last_match.kw
|
||||||
|
start = last_match.start
|
||||||
|
finish = start
|
||||||
|
is_multiline = true
|
||||||
|
else
|
||||||
|
last_match = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if kw then
|
||||||
|
kw = Config.keywords[kw] or kw
|
||||||
|
end
|
||||||
|
|
||||||
|
local opts = Config.options.keywords[kw]
|
||||||
|
|
||||||
|
if opts then
|
||||||
|
start = start - 1
|
||||||
|
finish = finish - 1
|
||||||
|
|
||||||
|
local hl_fg = "TodoFg" .. kw
|
||||||
|
local hl_bg = "TodoBg" .. kw
|
||||||
|
|
||||||
|
local hl = Config.options.highlight
|
||||||
|
|
||||||
|
if not is_multiline then
|
||||||
|
-- before highlights
|
||||||
|
if hl.before == "fg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_fg, lnum, 0, start)
|
||||||
|
elseif hl.before == "bg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_bg, lnum, 0, start)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- tag highlights
|
||||||
|
if hl.keyword == "wide" or hl.keyword == "wide_bg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_bg, lnum, math.max(start - 1, 0), finish + 1)
|
||||||
|
elseif hl.keyword == "wide_fg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_fg, lnum, math.max(start - 1, 0), finish + 1)
|
||||||
|
elseif hl.keyword == "bg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_bg, lnum, start, finish)
|
||||||
|
elseif hl.keyword == "fg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_fg, lnum, start, finish)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- after highlights
|
||||||
|
if hl.after == "fg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_fg, lnum, finish, #line)
|
||||||
|
elseif hl.after == "bg" then
|
||||||
|
add_highlight(buf, Config.ns, hl_bg, lnum, finish, #line)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not is_multiline then
|
||||||
|
-- signs
|
||||||
|
local show_sign = Config.options.signs
|
||||||
|
if opts.signs ~= nil then
|
||||||
|
show_sign = opts.signs
|
||||||
|
end
|
||||||
|
if show_sign then
|
||||||
|
vim.fn.sign_place(
|
||||||
|
0,
|
||||||
|
"todo-signs",
|
||||||
|
"todo-sign-" .. kw,
|
||||||
|
buf,
|
||||||
|
{ lnum = lnum + 1, priority = Config.options.sign_priority }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- highlights the visible range of the window
|
||||||
|
function M.highlight_win(win, force)
|
||||||
|
win = win or vim.api.nvim_get_current_win()
|
||||||
|
if force ~= true and not M.is_valid_win(win) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_win_call(win, function()
|
||||||
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
|
local first = vim.fn.line("w0") - 1
|
||||||
|
local last = vim.fn.line("w$")
|
||||||
|
M.redraw(buf, first, last)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.is_float(win)
|
||||||
|
local opts = vim.api.nvim_win_get_config(win)
|
||||||
|
return opts and opts.relative and opts.relative ~= ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.is_valid_win(win)
|
||||||
|
if not vim.api.nvim_win_is_valid(win) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- avoid E5108 after pressing q:
|
||||||
|
if vim.fn.getcmdwintype() ~= "" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- dont do anything for floating windows
|
||||||
|
if M.is_float(win) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
|
return M.is_valid_buf(buf)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.is_quickfix(buf)
|
||||||
|
return vim.api.nvim_buf_get_option(buf, "buftype") == "quickfix"
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.is_valid_buf(buf)
|
||||||
|
-- Skip special buffers
|
||||||
|
local buftype = vim.api.nvim_buf_get_option(buf, "buftype")
|
||||||
|
if buftype ~= "" and buftype ~= "quickfix" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local filetype = vim.api.nvim_buf_get_option(buf, "filetype")
|
||||||
|
if vim.tbl_contains(Config.options.highlight.exclude, filetype) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- will attach to the buf in the window and highlight the active buf if needed
|
||||||
|
function M.attach(win)
|
||||||
|
win = win or vim.api.nvim_get_current_win()
|
||||||
|
if not M.is_valid_win(win) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
|
|
||||||
|
if not M.bufs[buf] then
|
||||||
|
vim.api.nvim_buf_attach(buf, false, {
|
||||||
|
on_lines = function(_event, _buf, _tick, first, _last, last_new)
|
||||||
|
if not M.enabled then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- detach from this buffer in case we no longer want it
|
||||||
|
if not M.is_valid_buf(buf) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
M.redraw(buf, first, last_new)
|
||||||
|
end,
|
||||||
|
on_detach = function()
|
||||||
|
M.state[buf] = nil
|
||||||
|
M.bufs[buf] = nil
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local highlighter = require("vim.treesitter.highlighter")
|
||||||
|
local hl = highlighter.active[buf]
|
||||||
|
if hl then
|
||||||
|
-- also listen to TS changes so we can properly update the buffer based on is_comment
|
||||||
|
hl.tree:register_cbs({
|
||||||
|
on_bytes = function(_, _, row)
|
||||||
|
M.redraw(buf, row, row + 1)
|
||||||
|
end,
|
||||||
|
on_changedtree = function(changes)
|
||||||
|
for _, ch in ipairs(changes or {}) do
|
||||||
|
M.redraw(buf, ch[1], ch[3] + 1)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
M.bufs[buf] = true
|
||||||
|
M.highlight_win(win)
|
||||||
|
M.wins[win] = true
|
||||||
|
elseif not M.wins[win] then
|
||||||
|
M.highlight_win(win)
|
||||||
|
M.wins[win] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.stop()
|
||||||
|
M.enabled = false
|
||||||
|
pcall(vim.cmd, "autocmd! Todo")
|
||||||
|
pcall(vim.cmd, "augroup! Todo")
|
||||||
|
M.wins = {}
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: missing-parameter
|
||||||
|
vim.fn.sign_unplace("todo-signs")
|
||||||
|
for buf, _ in pairs(M.bufs) do
|
||||||
|
if vim.api.nvim_buf_is_valid(buf) then
|
||||||
|
pcall(vim.api.nvim_buf_clear_namespace, buf, Config.ns, 0, -1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
M.bufs = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.start()
|
||||||
|
if M.enabled then
|
||||||
|
M.stop()
|
||||||
|
end
|
||||||
|
M.enabled = true
|
||||||
|
-- setup autocmds
|
||||||
|
-- TODO: make some of the below configurable
|
||||||
|
vim.api.nvim_exec(
|
||||||
|
[[augroup Todo
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWinEnter,WinNew * lua require("todo-comments.highlight").attach()
|
||||||
|
autocmd BufWritePost * silent! lua require'trouble'.refresh({auto = true, provider = "todo"})
|
||||||
|
autocmd WinScrolled * lua require("todo-comments.highlight").highlight_win()
|
||||||
|
autocmd ColorScheme * lua vim.defer_fn(require("todo-comments.config").colors, 10)
|
||||||
|
augroup end]],
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
-- attach to all bufs in visible windows
|
||||||
|
for _, win in pairs(vim.api.nvim_list_wins()) do
|
||||||
|
M.attach(win)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
local config = require("todo-comments.config")
|
||||||
|
local jump = require("todo-comments.jump")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.setup = config.setup
|
||||||
|
|
||||||
|
function M.reset()
|
||||||
|
require("plenary.reload").reload_module("todo")
|
||||||
|
require("todo-comments").setup()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.disable()
|
||||||
|
require("todo-comments.highlight").stop()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.enable()
|
||||||
|
require("todo-comments.highlight").start()
|
||||||
|
end
|
||||||
|
|
||||||
|
M.jump_prev = jump.prev
|
||||||
|
M.jump_next = jump.next
|
||||||
|
|
||||||
|
return M
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
local highlight = require("todo-comments.highlight")
|
||||||
|
local config = require("todo-comments.config")
|
||||||
|
local util = require("todo-comments.util")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param up boolean
|
||||||
|
local function jump(up, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.keywords = opts.keywords or {}
|
||||||
|
|
||||||
|
local win = vim.api.nvim_get_current_win()
|
||||||
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
|
|
||||||
|
local pos = vim.api.nvim_win_get_cursor(win)
|
||||||
|
|
||||||
|
local from = pos[1] + 1
|
||||||
|
local to = vim.api.nvim_buf_line_count(buf)
|
||||||
|
|
||||||
|
if up then
|
||||||
|
from = pos[1] - 1
|
||||||
|
to = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
for l = from, to, up and -1 or 1 do
|
||||||
|
local line = vim.api.nvim_buf_get_lines(buf, l - 1, l, false)[1] or ""
|
||||||
|
local ok, start, _, kw = pcall(highlight.match, line)
|
||||||
|
|
||||||
|
if ok and start then
|
||||||
|
if config.options.highlight.comments_only and highlight.is_comment(buf, l - 1, start) == false then
|
||||||
|
kw = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if kw and #opts.keywords > 0 and not vim.tbl_contains(opts.keywords, kw) then
|
||||||
|
kw = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if kw then
|
||||||
|
vim.api.nvim_win_set_cursor(win, { l, start - 1 })
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
util.warn("No more todo comments to jump to")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.next(opts)
|
||||||
|
jump(false, opts)
|
||||||
|
end
|
||||||
|
function M.prev(opts)
|
||||||
|
jump(true, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@ -0,0 +1,130 @@
|
|||||||
|
local Config = require("todo-comments.config")
|
||||||
|
local Highlight = require("todo-comments.highlight")
|
||||||
|
local Util = require("todo-comments.util")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function keywords_filter(opts_keywords)
|
||||||
|
assert(not opts_keywords or type(opts_keywords) == "string", "'keywords' must be a comma separated string or nil")
|
||||||
|
local all_keywords = vim.tbl_keys(Config.keywords)
|
||||||
|
if not opts_keywords then
|
||||||
|
return all_keywords
|
||||||
|
end
|
||||||
|
local filters = vim.split(opts_keywords, ",")
|
||||||
|
return vim.tbl_filter(function(kw)
|
||||||
|
return vim.tbl_contains(filters, kw)
|
||||||
|
end, all_keywords)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.process(lines)
|
||||||
|
local results = {}
|
||||||
|
for _, line in pairs(lines) do
|
||||||
|
local file, row, col, text = line:match("^(.+):(%d+):(%d+):(.*)$")
|
||||||
|
if file then
|
||||||
|
local item = {
|
||||||
|
filename = file,
|
||||||
|
lnum = tonumber(row),
|
||||||
|
col = tonumber(col),
|
||||||
|
line = text,
|
||||||
|
}
|
||||||
|
|
||||||
|
local start, finish, kw = Highlight.match(text)
|
||||||
|
|
||||||
|
if start then
|
||||||
|
kw = Config.keywords[kw] or kw
|
||||||
|
item.tag = kw
|
||||||
|
item.text = vim.trim(text:sub(start))
|
||||||
|
item.message = vim.trim(text:sub(finish + 1))
|
||||||
|
table.insert(results, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return results
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.search(cb, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.cwd = opts.cwd or "."
|
||||||
|
opts.cwd = vim.fn.fnamemodify(opts.cwd, ":p")
|
||||||
|
opts.disable_not_found_warnings = opts.disable_not_found_warnings or false
|
||||||
|
if not Config.loaded then
|
||||||
|
Util.error("todo-comments isn't loaded. Did you run setup()?")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local command = Config.options.search.command
|
||||||
|
|
||||||
|
if vim.fn.executable(command) ~= 1 then
|
||||||
|
Util.error(command .. " was not found on your path")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, Job = pcall(require, "plenary.job")
|
||||||
|
if not ok then
|
||||||
|
Util.error("search requires https://github.com/nvim-lua/plenary.nvim")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local args =
|
||||||
|
vim.tbl_flatten({ Config.options.search.args, Config.search_regex(keywords_filter(opts.keywords)), opts.cwd })
|
||||||
|
Job
|
||||||
|
:new({
|
||||||
|
command = command,
|
||||||
|
args = args,
|
||||||
|
on_exit = vim.schedule_wrap(function(j, code)
|
||||||
|
if code == 2 then
|
||||||
|
local error = table.concat(j:stderr_result(), "\n")
|
||||||
|
Util.error(command .. " failed with code " .. code .. "\n" .. error)
|
||||||
|
end
|
||||||
|
if code == 1 and opts.disable_not_found_warnings ~= true then
|
||||||
|
Util.warn("no todos found")
|
||||||
|
end
|
||||||
|
local lines = j:result()
|
||||||
|
cb(M.process(lines))
|
||||||
|
end),
|
||||||
|
})
|
||||||
|
:start()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function parse_opts(opts)
|
||||||
|
if not opts or type(opts) ~= "string" then
|
||||||
|
return opts
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
keywords = opts:match("keywords=(%S*)"),
|
||||||
|
cwd = opts:match("cwd=(%S*)"),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setqflist(opts)
|
||||||
|
M.setlist(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setloclist(opts)
|
||||||
|
M.setlist(opts, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setlist(opts, use_loclist)
|
||||||
|
opts = parse_opts(opts) or {}
|
||||||
|
opts.open = (opts.open ~= nil and {opts.open} or {true})[1]
|
||||||
|
M.search(function(results)
|
||||||
|
if use_loclist then
|
||||||
|
vim.fn.setloclist(0, {}, " ", { title = "Todo", id = "$", items = results })
|
||||||
|
else
|
||||||
|
vim.fn.setqflist({}, " ", { title = "Todo", id = "$", items = results })
|
||||||
|
end
|
||||||
|
if opts.open then
|
||||||
|
if use_loclist then
|
||||||
|
vim.cmd([[lopen]])
|
||||||
|
else
|
||||||
|
vim.cmd([[copen]])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local win = vim.fn.getqflist({ winid = true })
|
||||||
|
if win.winid ~= 0 then
|
||||||
|
Highlight.highlight_win(win.winid, true)
|
||||||
|
end
|
||||||
|
end, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
--- @class Util
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.get_hl(name)
|
||||||
|
local ok, hl = pcall(vim.api.nvim_get_hl_by_name, name, true)
|
||||||
|
if not ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, key in pairs({ "foreground", "background", "special" }) do
|
||||||
|
if hl[key] then
|
||||||
|
hl[key] = string.format("#%06x", hl[key])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return hl
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.hex2rgb(hex)
|
||||||
|
hex = hex:gsub("#", "")
|
||||||
|
return tonumber("0x" .. hex:sub(1, 2)), tonumber("0x" .. hex:sub(3, 4)), tonumber("0x" .. hex:sub(5, 6))
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.rgb2hex(r, g, b)
|
||||||
|
return string.format("#%02x%02x%02x", r, g, b)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.is_dark(hex)
|
||||||
|
local r, g, b = M.hex2rgb(hex)
|
||||||
|
local lum = (0.299 * r + 0.587 * g + 0.114 * b) / 255
|
||||||
|
return lum <= 0.5
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.warn(msg)
|
||||||
|
vim.notify(msg, vim.log.levels.WARN, { title = "TodoComments" })
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.error(msg)
|
||||||
|
vim.notify(msg, vim.log.levels.ERROR, { title = "TodoComments" })
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
local Search = require("todo-comments.search")
|
||||||
|
local util = require("trouble.util")
|
||||||
|
local Config = require("todo-comments.config")
|
||||||
|
|
||||||
|
local function todo(_win, _buf, cb, opts)
|
||||||
|
Search.search(function(results)
|
||||||
|
local ret = {}
|
||||||
|
for _, item in pairs(results) do
|
||||||
|
local row = (item.lnum == 0 and 1 or item.lnum) - 1
|
||||||
|
local col = (item.col == 0 and 1 or item.col) - 1
|
||||||
|
|
||||||
|
local pitem = {
|
||||||
|
row = row,
|
||||||
|
col = col,
|
||||||
|
message = item.text,
|
||||||
|
sign = Config.options.keywords[item.tag].icon,
|
||||||
|
sign_hl = "TodoFg" .. item.tag,
|
||||||
|
-- code = string.lower(item.tag),
|
||||||
|
-- source = "todo",
|
||||||
|
severity = 0,
|
||||||
|
range = {
|
||||||
|
start = { line = row, character = col },
|
||||||
|
["end"] = { line = row, character = -1 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
table.insert(ret, util.process_item(pitem, vim.fn.bufnr(item.filename, true)))
|
||||||
|
end
|
||||||
|
if #ret == 0 then
|
||||||
|
util.warn("no todos found")
|
||||||
|
end
|
||||||
|
cb(ret)
|
||||||
|
end, opts.cmd_options)
|
||||||
|
end
|
||||||
|
|
||||||
|
return todo
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
---@diagnostic disable: inject-field
|
||||||
|
local Config = require("todo-comments.config")
|
||||||
|
local Item = require("trouble.item")
|
||||||
|
local Search = require("todo-comments.search")
|
||||||
|
|
||||||
|
---@type trouble.Source
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
M.config = {
|
||||||
|
formatters = {
|
||||||
|
todo_icon = function(ctx)
|
||||||
|
return {
|
||||||
|
text = Config.options.keywords[ctx.item.tag].icon,
|
||||||
|
hl = "TodoFg" .. ctx.item.tag,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
modes = {
|
||||||
|
todo = {
|
||||||
|
events = { "BufEnter", "BufWritePost" },
|
||||||
|
source = "todo",
|
||||||
|
groups = {
|
||||||
|
{ "tag", format = "{todo_icon} {tag}" },
|
||||||
|
-- { "directory" },
|
||||||
|
{ "filename", format = "{file_icon} {filename} {count}" },
|
||||||
|
},
|
||||||
|
sort = { { buf = 0 }, "filename", "pos", "message" },
|
||||||
|
format = "{todo_icon} {text} {pos}",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function M.get(cb)
|
||||||
|
Search.search(function(results)
|
||||||
|
local items = {} ---@type trouble.Item[]
|
||||||
|
for _, item in pairs(results) do
|
||||||
|
local row = item.lnum
|
||||||
|
local col = item.col - 1
|
||||||
|
items[#items + 1] = Item.new({
|
||||||
|
buf = vim.fn.bufadd(item.filename),
|
||||||
|
pos = { row, col },
|
||||||
|
end_pos = { row, col + #item.tag },
|
||||||
|
text = item.text,
|
||||||
|
filename = item.filename,
|
||||||
|
item = item,
|
||||||
|
source = "todo",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
cb(items)
|
||||||
|
end, {})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
command! -nargs=* TodoQuickFix lua require("todo-comments.search").setqflist(<q-args>)
|
||||||
|
command! -nargs=* TodoLocList lua require("todo-comments.search").setloclist(<q-args>)
|
||||||
|
command! -nargs=* TodoTelescope Telescope todo-comments todo <args>
|
||||||
|
command! -nargs=* TodoTrouble Trouble todo <args>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
std="vim"
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
column_width = 120
|
||||||
|
[sort_requires]
|
||||||
|
enabled = true
|
||||||
|
|
||||||
49
config/neovim/store/lazy-plugins/todo-comments.nvim/vim.toml
Normal file
49
config/neovim/store/lazy-plugins/todo-comments.nvim/vim.toml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
[selene]
|
||||||
|
base = "lua51"
|
||||||
|
name = "vim"
|
||||||
|
|
||||||
|
[vim]
|
||||||
|
any = true
|
||||||
|
|
||||||
|
[jit]
|
||||||
|
any = true
|
||||||
|
|
||||||
|
[[describe.args]]
|
||||||
|
type = "string"
|
||||||
|
[[describe.args]]
|
||||||
|
type = "function"
|
||||||
|
|
||||||
|
[[it.args]]
|
||||||
|
type = "string"
|
||||||
|
[[it.args]]
|
||||||
|
type = "function"
|
||||||
|
|
||||||
|
[[before_each.args]]
|
||||||
|
type = "function"
|
||||||
|
[[after_each.args]]
|
||||||
|
type = "function"
|
||||||
|
|
||||||
|
[assert.is_not]
|
||||||
|
any = true
|
||||||
|
|
||||||
|
[[assert.equals.args]]
|
||||||
|
type = "any"
|
||||||
|
[[assert.equals.args]]
|
||||||
|
type = "any"
|
||||||
|
[[assert.equals.args]]
|
||||||
|
type = "any"
|
||||||
|
required = false
|
||||||
|
|
||||||
|
[[assert.same.args]]
|
||||||
|
type = "any"
|
||||||
|
[[assert.same.args]]
|
||||||
|
type = "any"
|
||||||
|
|
||||||
|
[[assert.truthy.args]]
|
||||||
|
type = "any"
|
||||||
|
|
||||||
|
[[assert.spy.args]]
|
||||||
|
type = "any"
|
||||||
|
|
||||||
|
[[assert.stub.args]]
|
||||||
|
type = "any"
|
||||||
@ -186,10 +186,11 @@ rec {
|
|||||||
neovide = true;
|
neovide = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# lazyvim = {
|
lazyvim = {
|
||||||
# enable = true;
|
# enable = true;
|
||||||
# alias = true;
|
alias = true;
|
||||||
# };
|
neovide = true;
|
||||||
|
};
|
||||||
|
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@ -40,7 +40,7 @@ in {
|
|||||||
|
|
||||||
(optionalAttrs cfg.vaapi {
|
(optionalAttrs cfg.vaapi {
|
||||||
# LIBVA_DRIVER_NAME = "radeonsi"; # "nvidia" for Nvidia card
|
# LIBVA_DRIVER_NAME = "radeonsi"; # "nvidia" for Nvidia card
|
||||||
LIBVA_DRIVER_NAME = "nvidia";
|
# LIBVA_DRIVER_NAME = "nvidia"; # Specified in hardware-configuration
|
||||||
MOZ_DISABLE_RDD_SANDBOX = 1;
|
MOZ_DISABLE_RDD_SANDBOX = 1;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
@ -161,11 +161,11 @@ in {
|
|||||||
# "gfx.webrender.enabled" = true; # Does not exist?
|
# "gfx.webrender.enabled" = true; # Does not exist?
|
||||||
"gfx.x11-egl.force-enabled" = true;
|
"gfx.x11-egl.force-enabled" = true;
|
||||||
"layers.acceleration.force-enabled" = true;
|
"layers.acceleration.force-enabled" = true;
|
||||||
# "media.av1.enabled" = false;
|
"media.av1.enabled" = true;
|
||||||
"media.ffmpeg.vaapi.enabled" = true;
|
"media.ffmpeg.vaapi.enabled" = true;
|
||||||
"media.hardware-video-decoding.force-enabled" = true;
|
"media.hardware-video-decoding.force-enabled" = true;
|
||||||
# "media.rdd-ffmpeg.enabled" = true; # Default value
|
"media.rdd-ffmpeg.enabled" = true; # Default value
|
||||||
# "widget.dmabuf.force-enabled" = true;
|
"widget.dmabuf.force-enabled" = true;
|
||||||
# "widget.wayland-dmabuf-vaapi.enabled" = true; # Does not exist?
|
# "widget.wayland-dmabuf-vaapi.enabled" = true; # Does not exist?
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
41
home/modules/lazyvim/extraConfigLua.lua
Normal file
41
home/modules/lazyvim/extraConfigLua.lua
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
-- Package manager setup
|
||||||
|
require("lazy").setup({
|
||||||
|
defaults = {
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
dev = {
|
||||||
|
-- reuse files from pkgs.vimPlugins.*
|
||||||
|
path = "@lazyPath@", -- NOTE: Will be replaced by the nix path
|
||||||
|
patterns = { "." },
|
||||||
|
-- fallback to download
|
||||||
|
fallback = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
spec = {
|
||||||
|
-- { "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||||
|
-- The following configs are needed for fixing lazyvim on nix
|
||||||
|
-- force enable telescope-fzf-native.nvim
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = true },
|
||||||
|
-- disable mason.nvim, use config.extraPackages
|
||||||
|
{ "williamboman/mason-lspconfig.nvim", enabled = false },
|
||||||
|
{ "williamboman/mason.nvim", enabled = false },
|
||||||
|
-- uncomment to import/override with your plugins
|
||||||
|
-- { import = "plugins" },
|
||||||
|
-- put this line at the end of spec to clear ensure_installed
|
||||||
|
{ "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = {} } },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Hide inline diagnostics and show border
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
float = { border = "rounded" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Allow navigating popupmenu completion with Up/Down
|
||||||
|
vim.api.nvim_set_keymap("c", "<Down>", 'v:lua.get_wildmenu_key("<right>", "<down>")', { expr = true })
|
||||||
|
vim.api.nvim_set_keymap("c", "<Up>", 'v:lua.get_wildmenu_key("<left>", "<up>")', { expr = true })
|
||||||
|
function _G.get_wildmenu_key(key_wildmenu, key_regular)
|
||||||
|
return vim.fn.wildmenumode() ~= 0 and key_wildmenu or key_regular
|
||||||
|
end
|
||||||
24
home/modules/lazyvim/extraConfigLuaPost.lua
Normal file
24
home/modules/lazyvim/extraConfigLuaPost.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
local opt = vim.opt
|
||||||
|
local g = vim.g
|
||||||
|
local o = vim.o
|
||||||
|
|
||||||
|
-- Neovide
|
||||||
|
if g.neovide then
|
||||||
|
-- require("notify").notify("Running in NeoVide")
|
||||||
|
|
||||||
|
g.neovide_cursor_animate_command_line = true
|
||||||
|
g.neovide_cursor_animate_in_insert_mode = true
|
||||||
|
-- g.neovide_fullscreen = false
|
||||||
|
g.neovide_hide_mouse_when_typing = true
|
||||||
|
g.neovide_padding_top = 0
|
||||||
|
g.neovide_padding_bottom = 0
|
||||||
|
g.neovide_padding_right = 0
|
||||||
|
g.neovide_padding_left = 0
|
||||||
|
g.neovide_refresh_rate = 144
|
||||||
|
-- g.neovide_theme = "light"
|
||||||
|
|
||||||
|
-- Neovide Fonts
|
||||||
|
o.guifont = "JetBrainsMono Nerd Font:h13:Medium"
|
||||||
|
else
|
||||||
|
-- require("notify").notify("Not running in NeoVide")
|
||||||
|
end
|
||||||
493
home/modules/lazyvim/keybinds.nix
Normal file
493
home/modules/lazyvim/keybinds.nix
Normal file
@ -0,0 +1,493 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
mylib,
|
||||||
|
...
|
||||||
|
}: [
|
||||||
|
# No Leader
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-s>";
|
||||||
|
action = "<cmd>w<CR>";
|
||||||
|
options.desc = "Save current buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-S-s>";
|
||||||
|
action = "<cmd>wa<CR>";
|
||||||
|
options.desc = "Save all buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<";
|
||||||
|
action = "<gv";
|
||||||
|
options.desc = "Outdent";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = ">";
|
||||||
|
action = ">gv";
|
||||||
|
options.desc = "Indent";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<";
|
||||||
|
action = "v<<Esc>";
|
||||||
|
options.desc = "Outdent";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = ">";
|
||||||
|
action = "v><Esc>";
|
||||||
|
options.desc = "Indent";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-d>";
|
||||||
|
action = "<C-d>zz";
|
||||||
|
options.desc = "Jump down";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-u>";
|
||||||
|
action = "<C-u>zz";
|
||||||
|
options.desc = "Jump up";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "n";
|
||||||
|
action = "nzzzv";
|
||||||
|
options.desc = "Next match";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "N";
|
||||||
|
action = "Nzzzv";
|
||||||
|
options.desc = "Previous match";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<Tab>";
|
||||||
|
action = "<cmd>lua require('intellitab').indent()<CR>";
|
||||||
|
options.desc = "Indent";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<C-BS>";
|
||||||
|
action = "<C-w>";
|
||||||
|
options.desc = "Delete previous word";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<M-BS>";
|
||||||
|
action = "<C-w>";
|
||||||
|
options.desc = "Delete previous word";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<C-S-v>";
|
||||||
|
action = "<Esc>\"+pi";
|
||||||
|
options.desc = "Paste from clipboard";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<C-v>";
|
||||||
|
action = "<Esc>\"+pi";
|
||||||
|
options.desc = "Paste from clipboard";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<C-S-c>";
|
||||||
|
action = "\"+y";
|
||||||
|
options.desc = "Copy to clipboard";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-h>";
|
||||||
|
action = "<cmd>nohlsearch<CR>";
|
||||||
|
options.desc = "Clear search highlights";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "K";
|
||||||
|
action = "<cmd>lua vim.lsp.buf.hover()<CR>";
|
||||||
|
options.desc = "Show LSP hover";
|
||||||
|
}
|
||||||
|
|
||||||
|
# General <leader>
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>qq";
|
||||||
|
action = "<cmd>quitall<CR>";
|
||||||
|
options.desc = "Quit";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>q!";
|
||||||
|
action = "<cmd>quitall!<CR>";
|
||||||
|
options.desc = "Forceful quit";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>L";
|
||||||
|
action = "<cmd>Lazy<CR>";
|
||||||
|
options.desc = "Show Lazy";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader><Space>";
|
||||||
|
action = "<cmd>Telescope buffers<CR>";
|
||||||
|
options.desc = "Show open buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>S";
|
||||||
|
action = "<cmd>wa<CR>";
|
||||||
|
options.desc = "Save all buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>f";
|
||||||
|
action = "<cmd>Telescope find_files<CR>";
|
||||||
|
options.desc = "Find file";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>o";
|
||||||
|
action = "<cmd>Telescope vim_options<CR>";
|
||||||
|
options.desc = "Show Vim options";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>u";
|
||||||
|
action = "<cmd>Telescope undo<CR>";
|
||||||
|
options.desc = "Show undo history";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>/";
|
||||||
|
action = "<cmd>Telescope current_buffer_fuzzy_find<CR>";
|
||||||
|
options.desc = "Find in current buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>n";
|
||||||
|
action = "<cmd>Telescope notify<CR>";
|
||||||
|
options.desc = "Show notify history";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>s";
|
||||||
|
action = "<cmd>Telescope live_grep<CR>";
|
||||||
|
options.desc = "Find in working directory";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>r";
|
||||||
|
action = "<cmd>Telescope resume<CR>";
|
||||||
|
options.desc = "Show last telescope picker";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>?";
|
||||||
|
action = "<cmd>Telescope keymaps<CR>";
|
||||||
|
options.desc = "Show keymaps";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>:";
|
||||||
|
action = "<cmd>Telescope commands<CR>";
|
||||||
|
options.desc = "Execute command";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>M";
|
||||||
|
action = "<cmd>Telescope marks<CR>";
|
||||||
|
options.desc = "Show marks";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>J";
|
||||||
|
action = "<cmd>Telescope jumplist<CR>";
|
||||||
|
options.desc = "Show jumplist";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>m";
|
||||||
|
action = "<cmd>Telescope man_pages<CR>";
|
||||||
|
options.desc = "Show manpages";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>h";
|
||||||
|
action = "<cmd>Telescope help_tags<CR>";
|
||||||
|
options.desc = "Show help tags";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Quit <leader>q
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>q";
|
||||||
|
action = "+quit";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Buffers <leader>b
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>b";
|
||||||
|
action = "+buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bb";
|
||||||
|
action = "<cmd>Telescope buffers<CR>";
|
||||||
|
options.desc = "Show open buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bn";
|
||||||
|
action = "<cmd>bnext<CR>";
|
||||||
|
options.desc = "Goto next buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bp";
|
||||||
|
action = "<cmd>bprevious<CR>";
|
||||||
|
options.desc = "Goto previous buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bd";
|
||||||
|
action = "<cmd>Bdelete<CR>";
|
||||||
|
options.desc = "Close current buffer";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Windows <leader>w
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>w";
|
||||||
|
action = "+windows";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ws";
|
||||||
|
action = "<C-w>s";
|
||||||
|
options.desc = "Split window horizontally";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>wv";
|
||||||
|
action = "<C-w>v";
|
||||||
|
options.desc = "Split window vertically";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>wd";
|
||||||
|
action = "<C-w>c";
|
||||||
|
options.desc = "Close current window";
|
||||||
|
}
|
||||||
|
# {
|
||||||
|
# mode = "n";
|
||||||
|
# key = "<leader>wh";
|
||||||
|
# action = "<C-W>s";
|
||||||
|
# options.desc = "Split window horizontally";
|
||||||
|
# }
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>wh";
|
||||||
|
action = "<C-w>h";
|
||||||
|
options.desc = "Goto left window";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>wl";
|
||||||
|
action = "<C-w>l";
|
||||||
|
options.desc = "Goto right window";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>wj";
|
||||||
|
action = "<C-w>j";
|
||||||
|
options.desc = "Goto bottom window";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>wk";
|
||||||
|
action = "<C-w>k";
|
||||||
|
options.desc = "Goto top window";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ww";
|
||||||
|
action = "<C-w>p";
|
||||||
|
options.desc = "Goto other window";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Toggles <leader>t
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>t";
|
||||||
|
action = "+toggle";
|
||||||
|
}
|
||||||
|
# {
|
||||||
|
# mode = "n";
|
||||||
|
# key = "<leader>tt";
|
||||||
|
# action = "<cmd>Neotree action=show toggle=true<CR>";
|
||||||
|
# options.desc = "Toggle NeoTree";
|
||||||
|
# }
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>tt";
|
||||||
|
action = "<cmd>CHADopen --nofocus<CR>";
|
||||||
|
options.desc = "Toggle CHADtree";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>tn";
|
||||||
|
action = "<cmd>Navbuddy<CR>";
|
||||||
|
options.desc = "Toggle NavBuddy";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>td";
|
||||||
|
action = "<cmd>TroubleToggle focus=false<CR>";
|
||||||
|
options.desc = "Toggle Trouble";
|
||||||
|
}
|
||||||
|
# {
|
||||||
|
# mode = "n";
|
||||||
|
# key = "<leader>tg";
|
||||||
|
# action = "<cmd>LazyGit<CR>";
|
||||||
|
# }
|
||||||
|
# {
|
||||||
|
# mode = "n";
|
||||||
|
# key = "<leader>tp";
|
||||||
|
# action = "<cmd>TroubleToggle<CR>";
|
||||||
|
# }
|
||||||
|
|
||||||
|
# Git <leader>g
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>g";
|
||||||
|
action = "+git";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>gg";
|
||||||
|
action = "<cmd>LazyGit<CR>";
|
||||||
|
options.desc = "Show LazyGit";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>gm";
|
||||||
|
action = "<cmd>GitMessenger<CR>";
|
||||||
|
options.desc = "Show GitMessenger";
|
||||||
|
}
|
||||||
|
# {
|
||||||
|
# mode = "n";
|
||||||
|
# key = "<leader>gs";
|
||||||
|
# action = "<cmd>Git status<CR>";
|
||||||
|
# }
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>gs";
|
||||||
|
action = "<cmd>Telescope git_status<CR>";
|
||||||
|
options.desc = "Show Git status";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>gc";
|
||||||
|
action = "<cmd>Telescope git_commits<CR>";
|
||||||
|
options.desc = "Show Git log";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>gb";
|
||||||
|
action = "<cmd>Telescope git_branches<CR>";
|
||||||
|
options.desc = "Show Git branches";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>gf";
|
||||||
|
action = "<cmd>Telescope git_bcommits<CR>";
|
||||||
|
options.desc = "Show Git log for current file";
|
||||||
|
}
|
||||||
|
|
||||||
|
# LSP <leader>l
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>l";
|
||||||
|
action = "+lsp";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>lr";
|
||||||
|
action = "<cmd>Telescope lsp_references<CR>";
|
||||||
|
options.desc = "Goto references";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ld";
|
||||||
|
action = "<cmd>Telescope lsp_definitions<CR>";
|
||||||
|
options.desc = "Goto definition";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>li";
|
||||||
|
action = "<cmd>Telescope lsp_implementations<CR>";
|
||||||
|
options.desc = "Goto implementation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>lt";
|
||||||
|
action = "<cmd>Telescope lsp_type_definitions<CR>";
|
||||||
|
options.desc = "Goto type definition";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>lI";
|
||||||
|
action = "<cmd>Telescope lsp_incoming_calls<CR>";
|
||||||
|
options.desc = "Show incoming calls";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>lO";
|
||||||
|
action = "<cmd>Telescope lsp_outgoing_calls<CR>";
|
||||||
|
options.desc = "Show outgoing calls";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Code <leader>c
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>c";
|
||||||
|
action = "+code";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>cf";
|
||||||
|
action = "<cmd>lua require('conform').format()<CR>";
|
||||||
|
options.desc = "Format current buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>cd";
|
||||||
|
action = "<cmd>Telescope diagnostics<CR>";
|
||||||
|
options.desc = "Show diagnostics";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>cr";
|
||||||
|
action = "<cmd>lua vim.lsp.buf.rename()<CR>";
|
||||||
|
options.desc = "Rename LSP symbol";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ca";
|
||||||
|
action = "<cmd>lua vim.lsp.buf.code_action()<CR>";
|
||||||
|
options.desc = "Show LSP code actions";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>cD";
|
||||||
|
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
|
||||||
|
options.desc = "Show LSP line diagnostics";
|
||||||
|
}
|
||||||
|
]
|
||||||
64
home/modules/lazyvim/vim_opts.nix
Normal file
64
home/modules/lazyvim/vim_opts.nix
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
mylib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
showmode = false; # Status line already shows this
|
||||||
|
backspace = ["indent" "eol" "start"];
|
||||||
|
termguicolors = true; # Required by multiple plugins
|
||||||
|
hidden = true; # Don't unload buffers immediately
|
||||||
|
mouse = "a";
|
||||||
|
completeopt = ["menuone" "noselect" "noinsert"];
|
||||||
|
timeoutlen = 50;
|
||||||
|
pumheight = 0;
|
||||||
|
formatexpr = "v:lua.require('conform').formatexpr()";
|
||||||
|
laststatus = 3;
|
||||||
|
# winblend = 30;
|
||||||
|
|
||||||
|
# Cursor
|
||||||
|
ruler = true; # Show cursor position in status line
|
||||||
|
number = true;
|
||||||
|
relativenumber = true;
|
||||||
|
signcolumn = "yes";
|
||||||
|
cursorline = true;
|
||||||
|
scrolloff = 10;
|
||||||
|
|
||||||
|
# Folding
|
||||||
|
foldcolumn = "0";
|
||||||
|
foldlevel = 99;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
foldenable = true;
|
||||||
|
# foldmethod = "expr";
|
||||||
|
# foldexpr = "nvim_treesitter#foldexpr()";
|
||||||
|
|
||||||
|
# Files
|
||||||
|
encoding = "utf-8";
|
||||||
|
fileencoding = "utf-8";
|
||||||
|
# swapfile = true;
|
||||||
|
# backup = false;
|
||||||
|
undofile = true;
|
||||||
|
undodir = "/home/christoph/.vim/undo";
|
||||||
|
# autochdir = true;
|
||||||
|
|
||||||
|
# Search
|
||||||
|
incsearch = true; # Already highlight results while typing
|
||||||
|
hlsearch = true;
|
||||||
|
ignorecase = true;
|
||||||
|
smartcase = true;
|
||||||
|
grepprg = "rg --vimgrep";
|
||||||
|
grepformat = "%f:%l:%c:%m";
|
||||||
|
|
||||||
|
# Indentation
|
||||||
|
autoindent = false; # Use previous line indentation level - Might mess up comment indentation
|
||||||
|
smartindent = false; # Like autoindent but recognizes some C syntax - Might mess up comment indentation
|
||||||
|
cindent = true;
|
||||||
|
cinkeys = "0{,0},0),0],:,!^F,o,O,e"; # Fix comment (#) indentation and intellitab (somehow)
|
||||||
|
smarttab = true;
|
||||||
|
expandtab = true;
|
||||||
|
shiftwidth = 4;
|
||||||
|
tabstop = 4;
|
||||||
|
softtabstop = 4;
|
||||||
|
|
||||||
|
splitbelow = true;
|
||||||
|
splitright = true;
|
||||||
|
}
|
||||||
@ -64,35 +64,14 @@ in {
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
home.file.".config/neovide/config.toml".text = ''
|
home.file.".config/neovide/config.toml".source = ./neovide_config.ini;
|
||||||
fork = true # Start neovide detached
|
home.file.".config/vale/.vale.ini".source = ./vale_config.ini;
|
||||||
frame = "none" # full, buttonless, none
|
|
||||||
idle = true # Don't render frames without changes
|
|
||||||
# maximized = true
|
|
||||||
title-hidden = true
|
|
||||||
# vsync = true
|
|
||||||
'';
|
|
||||||
|
|
||||||
home.file.".config/vale/.vale.ini".text = ''
|
|
||||||
# Core settings appear at the top
|
|
||||||
# (the "global" section).
|
|
||||||
|
|
||||||
[formats]
|
|
||||||
# Format associations appear under
|
|
||||||
# the optional "formats" section.
|
|
||||||
|
|
||||||
[*]
|
|
||||||
# Format-specific settings appear
|
|
||||||
# under a user-provided "glob"
|
|
||||||
# pattern.
|
|
||||||
'';
|
|
||||||
|
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
enableMan = true;
|
enableMan = true;
|
||||||
luaLoader.enable = true; # NOTE: Experimental
|
luaLoader.enable = true; # NOTE: Experimental
|
||||||
# colorschemes.catppuccin.enable = true; # Managed using Lazy
|
|
||||||
viAlias = cfg.alias;
|
viAlias = cfg.alias;
|
||||||
vimAlias = cfg.alias;
|
vimAlias = cfg.alias;
|
||||||
|
|
||||||
@ -101,72 +80,11 @@ in {
|
|||||||
mallocalleader = " ";
|
mallocalleader = " ";
|
||||||
};
|
};
|
||||||
|
|
||||||
opts = {
|
opts = import ./vim_opts.nix {inherit lib mylib;};
|
||||||
showmode = false; # Status line already shows this
|
|
||||||
backspace = ["indent" "eol" "start"];
|
|
||||||
termguicolors = true; # Required by multiple plugins
|
|
||||||
hidden = true; # Don't unload buffers immediately
|
|
||||||
mouse = "a";
|
|
||||||
completeopt = ["menuone" "noselect" "noinsert"];
|
|
||||||
timeoutlen = 50;
|
|
||||||
pumheight = 0;
|
|
||||||
formatexpr = "v:lua.require('conform').formatexpr()";
|
|
||||||
laststatus = 3;
|
|
||||||
# winblend = 30;
|
|
||||||
|
|
||||||
# Cursor
|
|
||||||
ruler = true; # Show cursor position in status line
|
|
||||||
number = true;
|
|
||||||
relativenumber = true;
|
|
||||||
signcolumn = "yes";
|
|
||||||
cursorline = true;
|
|
||||||
scrolloff = 10;
|
|
||||||
|
|
||||||
# Folding
|
|
||||||
foldcolumn = "0";
|
|
||||||
foldlevel = 99;
|
|
||||||
foldlevelstart = 99;
|
|
||||||
foldenable = true;
|
|
||||||
# foldmethod = "expr";
|
|
||||||
# foldexpr = "nvim_treesitter#foldexpr()";
|
|
||||||
|
|
||||||
# Files
|
|
||||||
encoding = "utf-8";
|
|
||||||
fileencoding = "utf-8";
|
|
||||||
# swapfile = true;
|
|
||||||
# backup = false;
|
|
||||||
undofile = true;
|
|
||||||
undodir = "/home/christoph/.vim/undo";
|
|
||||||
# autochdir = true;
|
|
||||||
|
|
||||||
# Search
|
|
||||||
incsearch = true; # Already highlight results while typing
|
|
||||||
hlsearch = true;
|
|
||||||
ignorecase = true;
|
|
||||||
smartcase = true;
|
|
||||||
grepprg = "rg --vimgrep";
|
|
||||||
grepformat = "%f:%l:%c:%m";
|
|
||||||
|
|
||||||
# Indentation
|
|
||||||
autoindent = false; # Use previous line indentation level - Might mess up comment indentation
|
|
||||||
smartindent = false; # Like autoindent but recognizes some C syntax - Might mess up comment indentation
|
|
||||||
cindent = true;
|
|
||||||
cinkeys = "0{,0},0),0],:,!^F,o,O,e"; # Fix comment (#) indentation and intellitab (somehow)
|
|
||||||
smarttab = true;
|
|
||||||
expandtab = true;
|
|
||||||
shiftwidth = 4;
|
|
||||||
tabstop = 4;
|
|
||||||
softtabstop = 4;
|
|
||||||
|
|
||||||
splitbelow = true;
|
|
||||||
splitright = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
extraConfigLuaPost = builtins.readFile ./extraConfigLuaPost.lua;
|
extraConfigLuaPost = builtins.readFile ./extraConfigLuaPost.lua;
|
||||||
|
|
||||||
extraConfigLua = builtins.readFile ./extraConfigLua.lua;
|
extraConfigLua = builtins.readFile ./extraConfigLua.lua;
|
||||||
|
|
||||||
extraLuaPackages = with pkgs.lua51Packages; [];
|
# extraLuaPackages = with pkgs.lua51Packages; [];
|
||||||
|
|
||||||
extraPython3Packages = p: [
|
extraPython3Packages = p: [
|
||||||
# For CHADtree
|
# For CHADtree
|
||||||
@ -195,10 +113,13 @@ in {
|
|||||||
plugins.lazy = {
|
plugins.lazy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
plugins = builtins.concatLists [
|
plugins = let
|
||||||
(import ./interface.nix {inherit lib mylib pkgs;})
|
plenary = {
|
||||||
(import ./languages.nix {inherit lib mylib pkgs;})
|
name = "plenary"; # For telescope
|
||||||
[
|
pkg = pkgs.vimPlugins.plenary-nvim;
|
||||||
|
lazy = false;
|
||||||
|
};
|
||||||
|
in [
|
||||||
#
|
#
|
||||||
# Theme
|
# Theme
|
||||||
#
|
#
|
||||||
@ -242,6 +163,23 @@ in {
|
|||||||
# Plugins
|
# Plugins
|
||||||
#
|
#
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "autopairs";
|
||||||
|
pkg = pkgs.vimPlugins.nvim-autopairs;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("nvim-autopairs").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "bbye";
|
||||||
|
pkg = pkgs.vimPlugins.vim-bbye;
|
||||||
|
lazy = false;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "better-escape";
|
name = "better-escape";
|
||||||
pkg = pkgs.vimPlugins.better-escape-nvim;
|
pkg = pkgs.vimPlugins.better-escape-nvim;
|
||||||
@ -260,53 +198,73 @@ in {
|
|||||||
{
|
{
|
||||||
name = "chadtree";
|
name = "chadtree";
|
||||||
pkg = pkgs.vimPlugins.chadtree;
|
pkg = pkgs.vimPlugins.chadtree;
|
||||||
|
lazy = false;
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
vim.api.nvim_set_var("chadtree_settings", opts)
|
vim.api.nvim_set_var("chadtree_settings", opts)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
opts = {
|
opts = {
|
||||||
theme.text_colour_set = "nerdtree_syntax_dark";
|
# theme.text_colour_set = "nerdtree_syntax_dark";
|
||||||
|
theme.text_colour_set = "nord";
|
||||||
xdg = true;
|
xdg = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "clangd-extensions";
|
||||||
|
pkg = pkgs.vimPlugins.clangd_extensions-nvim;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("clangd_extensions").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "cmp";
|
name = "cmp";
|
||||||
pkg = pkgs.vimPlugins.nvim-cmp;
|
pkg = pkgs.vimPlugins.nvim-cmp;
|
||||||
|
lazy = false;
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{
|
{
|
||||||
name = "cmp-async-path";
|
name = "cmp-async-path";
|
||||||
pkg = pkgs.vimPlugins.cmp-async-path;
|
pkg = pkgs.vimPlugins.cmp-async-path;
|
||||||
|
lazy = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "cmp-buffer";
|
name = "cmp-buffer";
|
||||||
pkg = pkgs.vimPlugins.cmp-buffer;
|
pkg = pkgs.vimPlugins.cmp-buffer;
|
||||||
|
lazy = false;
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "cmp-cmdline";
|
name = "cmp-cmdline";
|
||||||
pkg = pkgs.vimPlugins.cmp-cmdline;
|
pkg = pkgs.vimPlugins.cmp-cmdline;
|
||||||
|
lazy = false;
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "cmp-emoji";
|
name = "cmp-emoji";
|
||||||
pkg = pkgs.vimPlugins.cmp-emoji;
|
pkg = pkgs.vimPlugins.cmp-emoji;
|
||||||
|
lazy = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "cmp-nvim-lsp";
|
name = "cmp-nvim-lsp";
|
||||||
pkg = pkgs.vimPlugins.cmp-nvim-lsp;
|
pkg = pkgs.vimPlugins.cmp-nvim-lsp;
|
||||||
|
lazy = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "cmp-nvim-lsp-signature-help";
|
name = "cmp-nvim-lsp-signature-help";
|
||||||
pkg = pkgs.vimPlugins.cmp-nvim-lsp-signature-help;
|
pkg = pkgs.vimPlugins.cmp-nvim-lsp-signature-help;
|
||||||
|
lazy = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "cmp-luasnip";
|
name = "cmp-luasnip";
|
||||||
pkg = pkgs.vimPlugins.cmp_luasnip;
|
pkg = pkgs.vimPlugins.cmp_luasnip;
|
||||||
|
lazy = false;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
lazy = false;
|
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
require("cmp").setup(opts)
|
require("cmp").setup(opts)
|
||||||
@ -389,9 +347,27 @@ in {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
# TODO: Only colorize html/css/scss/sass...
|
||||||
|
name = "colorizer";
|
||||||
|
pkg = pkgs.vimPlugins.nvim-colorizer-lua;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("colorizer").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
opts = {
|
||||||
|
filtetypes = null;
|
||||||
|
user_default_options = null;
|
||||||
|
buftypes = null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "comment";
|
name = "comment";
|
||||||
pkg = pkgs.vimPlugins.comment-nvim;
|
pkg = pkgs.vimPlugins.comment-nvim;
|
||||||
|
lazy = false;
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{
|
{
|
||||||
name = "ts-context-commentstring";
|
name = "ts-context-commentstring";
|
||||||
@ -423,10 +399,39 @@ in {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "conform";
|
||||||
|
pkg = pkgs.vimPlugins.conform-nvim;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("conform").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
c = ["clang-format"];
|
||||||
|
h = ["clang-format"];
|
||||||
|
cpp = ["clang-format"];
|
||||||
|
hpp = ["clang-format"];
|
||||||
|
css = [["prettierd" "prettier"]];
|
||||||
|
html = [["prettierd" "prettier"]];
|
||||||
|
java = ["google-java-format"];
|
||||||
|
javascript = [["prettierd" "prettier"]];
|
||||||
|
lua = ["stylua"];
|
||||||
|
markdown = [["prettierd" "prettier"]];
|
||||||
|
nix = ["alejandra"];
|
||||||
|
python = ["black"];
|
||||||
|
rust = ["rustfmt"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
# TODO: Config
|
# TODO: Config
|
||||||
{
|
{
|
||||||
name = "flash";
|
name = "flash";
|
||||||
pkg = pkgs.vimPlugins.flash-nvim;
|
pkg = pkgs.vimPlugins.flash-nvim;
|
||||||
|
lazy = false;
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
require("flash").setup(opts)
|
require("flash").setup(opts)
|
||||||
@ -437,6 +442,7 @@ in {
|
|||||||
{
|
{
|
||||||
name = "gitmessenger";
|
name = "gitmessenger";
|
||||||
pkg = pkgs.vimPlugins.git-messenger-vim;
|
pkg = pkgs.vimPlugins.git-messenger-vim;
|
||||||
|
lazy = false;
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
for k, v in pairs(opts) do
|
for k, v in pairs(opts) do
|
||||||
@ -466,6 +472,13 @@ in {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "haskell-tools";
|
||||||
|
pkg = pkgs.vimPlugins.haskell-tools-nvim;
|
||||||
|
lazy = false;
|
||||||
|
# Don't call setup!
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "illuminate";
|
name = "illuminate";
|
||||||
pkg = pkgs.vimPlugins.vim-illuminate;
|
pkg = pkgs.vimPlugins.vim-illuminate;
|
||||||
@ -510,12 +523,157 @@ in {
|
|||||||
{
|
{
|
||||||
name = "lazygit";
|
name = "lazygit";
|
||||||
pkg = pkgs.vimPlugins.lazygit-nvim;
|
pkg = pkgs.vimPlugins.lazygit-nvim;
|
||||||
|
lazy = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "lint";
|
||||||
|
pkg = pkgs.vimPlugins.nvim-lint;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
local lint = require("lint")
|
||||||
|
|
||||||
|
for k, v in pairs(opts) do
|
||||||
|
lint[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
opts = {
|
||||||
|
linters_by_ft = {
|
||||||
|
c = ["clang-tidy"];
|
||||||
|
h = ["clang-tidy"];
|
||||||
|
cpp = ["clang-tidy"];
|
||||||
|
hpp = ["clang-tidy"];
|
||||||
|
clojure = ["clj-kondo"];
|
||||||
|
java = ["checkstyle"];
|
||||||
|
javascript = ["eslint_d"];
|
||||||
|
lua = ["luacheck"];
|
||||||
|
markdown = ["vale"];
|
||||||
|
nix = ["statix"];
|
||||||
|
python = ["flake8"];
|
||||||
|
rust = ["clippy"];
|
||||||
|
text = ["vale"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "lspconfig";
|
||||||
|
pkg = pkgs.vimPlugins.nvim-lspconfig;
|
||||||
|
lazy = false;
|
||||||
|
dependencies = [
|
||||||
|
{
|
||||||
|
name = "neodev";
|
||||||
|
pkg = pkgs.vimPlugins.neodev-nvim;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("neodev").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
config = let
|
||||||
|
servers = mylib.generators.toLuaObject [
|
||||||
|
{name = "clangd";}
|
||||||
|
{name = "clojure_lsp";}
|
||||||
|
{name = "cmake";}
|
||||||
|
{name = "lua_ls";}
|
||||||
|
{name = "nil_ls";}
|
||||||
|
{name = "pyright";}
|
||||||
|
# {name = "rust_analyzer";} # Don't set up when using rustaceanvim
|
||||||
|
{name = "texlab";}
|
||||||
|
# {name = "hls";} # Don't set up when using haskell-tools
|
||||||
|
];
|
||||||
|
in ''
|
||||||
|
function(_, opts)
|
||||||
|
local __lspOnAttach = function(client, bufnr) end
|
||||||
|
|
||||||
|
local __lspCapabilities = function()
|
||||||
|
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
|
||||||
|
return capabilities
|
||||||
|
end
|
||||||
|
|
||||||
|
local __setup = {
|
||||||
|
on_attach = __lspOnAttach,
|
||||||
|
capabilities = __lspCapabilities(),
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, server in ipairs(${servers}) do
|
||||||
|
if type(server) == "string" then
|
||||||
|
require("lspconfig")[server].setup(__setup)
|
||||||
|
else
|
||||||
|
local options = server.extraOptions
|
||||||
|
|
||||||
|
if options == nil then
|
||||||
|
options = __setup
|
||||||
|
else
|
||||||
|
options = vim.tbl_extend("keep", options, __setup)
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lspconfig")[server.name].setup(options)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "lualine";
|
||||||
|
pkg = pkgs.vimPlugins.lualine-nvim;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("lualine").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
opts = {
|
||||||
|
extensions = ["fzf" "chadtree" "neo-tree" "toggleterm" "trouble"];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
always_divide_middle = true;
|
||||||
|
globalstatus = true;
|
||||||
|
ignore_focus = ["neo-tree" "chadtree"];
|
||||||
|
section_separators = {
|
||||||
|
left = "";
|
||||||
|
right = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
component_separators = {
|
||||||
|
left = "";
|
||||||
|
right = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sections = {
|
||||||
|
lualine_a = ["mode"];
|
||||||
|
lualine_b = ["branch" "diff" "diagnostics"];
|
||||||
|
lualine_c = [
|
||||||
|
{
|
||||||
|
name = "filename";
|
||||||
|
extraConfig.path = 1;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
lualine_x = ["filetype" "encoding" "fileformat"];
|
||||||
|
lualine_y = ["progress" "searchcount" "selectioncount"];
|
||||||
|
lualine_z = ["location"];
|
||||||
|
};
|
||||||
|
|
||||||
|
tabline = {
|
||||||
|
lualine_a = ["buffers"];
|
||||||
|
lualine_z = ["tabs"];
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: Snippet configs
|
# TODO: Snippet configs
|
||||||
{
|
{
|
||||||
name = "luasnip";
|
name = "luasnip";
|
||||||
pkg = pkgs.vimPlugins.luasnip;
|
pkg = pkgs.vimPlugins.luasnip;
|
||||||
|
lazy = false;
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
require("luasnip").config.set_config(opts)
|
require("luasnip").config.set_config(opts)
|
||||||
@ -526,6 +684,7 @@ in {
|
|||||||
{
|
{
|
||||||
name = "navbuddy";
|
name = "navbuddy";
|
||||||
pkg = pkgs.vimPlugins.nvim-navbuddy;
|
pkg = pkgs.vimPlugins.nvim-navbuddy;
|
||||||
|
lazy = false;
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
local actions = require("nvim-navbuddy.actions") -- ?
|
local actions = require("nvim-navbuddy.actions") -- ?
|
||||||
@ -542,6 +701,7 @@ in {
|
|||||||
{
|
{
|
||||||
name = "navic";
|
name = "navic";
|
||||||
pkg = pkgs.vimPlugins.nvim-navic;
|
pkg = pkgs.vimPlugins.nvim-navic;
|
||||||
|
lazy = false;
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
require("nvim-navic").setup(opts)
|
require("nvim-navic").setup(opts)
|
||||||
@ -555,44 +715,85 @@ in {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "autopairs";
|
name = "noice";
|
||||||
pkg = pkgs.vimPlugins.nvim-autopairs;
|
pkg = pkgs.vimPlugins.noice-nvim;
|
||||||
lazy = false;
|
lazy = false;
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("nvim-autopairs").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "colorizer";
|
|
||||||
pkg = pkgs.vimPlugins.nvim-colorizer-lua;
|
|
||||||
lazy = false;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("colorizer").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
filtetypes = null;
|
|
||||||
user_default_options = null;
|
|
||||||
buftypes = null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "ufo";
|
|
||||||
pkg = pkgs.vimPlugins.nvim-ufo;
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{
|
{
|
||||||
name = "promise";
|
name = "nui"; # For noice
|
||||||
pkg = pkgs.vimPlugins.promise-async;
|
pkg = pkgs.vimPlugins.nui-nvim;
|
||||||
|
lazy = false;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
require("ufo").setup(opts)
|
require("noice").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
opts = {
|
||||||
|
presets = {
|
||||||
|
bottom_search = false;
|
||||||
|
command_palette = true;
|
||||||
|
long_message_to_split = true;
|
||||||
|
inc_rename = true;
|
||||||
|
lsp_doc_border = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
documentation = {
|
||||||
|
opts = {
|
||||||
|
lang = "markdown";
|
||||||
|
replace = true;
|
||||||
|
render = "plain";
|
||||||
|
border = "rounded"; # single or rounded
|
||||||
|
format = ["{message}"];
|
||||||
|
win_options = {
|
||||||
|
concealcursor = "n";
|
||||||
|
conceallevel = 3;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
view = "hover";
|
||||||
|
};
|
||||||
|
|
||||||
|
override = {
|
||||||
|
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
||||||
|
"vim.lsp.util.stylize_markdown" = true;
|
||||||
|
"cmp.entry.get_documentation" = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
notify = {
|
||||||
|
enabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
popupmenu = {
|
||||||
|
enabled = true;
|
||||||
|
backend = "nui"; # cmp completion is broken
|
||||||
|
};
|
||||||
|
|
||||||
|
# cmdline.enabled = false;
|
||||||
|
# messages.enabled = false;
|
||||||
|
|
||||||
|
routes = [
|
||||||
|
# Hide inline search count info
|
||||||
|
{
|
||||||
|
filter = {
|
||||||
|
event = "msg_show";
|
||||||
|
kind = "search_count";
|
||||||
|
};
|
||||||
|
opts = {skip = true;};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "notify";
|
||||||
|
pkg = pkgs.vimPlugins.nvim-notify;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
vim.notify = require("notify")
|
||||||
|
require("notify").setup(opts)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
@ -603,6 +804,13 @@ in {
|
|||||||
lazy = false;
|
lazy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "rustaceanvim";
|
||||||
|
pkg = pkgs.vimPlugins.rustaceanvim;
|
||||||
|
lazy = false;
|
||||||
|
# Don't call setup!
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "sandwich";
|
name = "sandwich";
|
||||||
pkg = pkgs.vimPlugins.vim-sandwich;
|
pkg = pkgs.vimPlugins.vim-sandwich;
|
||||||
@ -615,6 +823,72 @@ in {
|
|||||||
lazy = false;
|
lazy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "telescope";
|
||||||
|
pkg = pkgs.vimPlugins.telescope-nvim;
|
||||||
|
lazy = false;
|
||||||
|
dependencies = [
|
||||||
|
plenary
|
||||||
|
# {
|
||||||
|
# name = "plenary"; # For telescope
|
||||||
|
# pkg = pkgs.vimPlugins.plenary-nvim;
|
||||||
|
# lazy = false;
|
||||||
|
# }
|
||||||
|
{
|
||||||
|
name = "telescope-undo";
|
||||||
|
pkg = pkgs.vimPlugins.telescope-undo-nvim;
|
||||||
|
lazy = false;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "telescope-ui-select";
|
||||||
|
pkg = pkgs.vimPlugins.telescope-ui-select-nvim;
|
||||||
|
lazy = false;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "telescope-fzf-native";
|
||||||
|
pkg = pkgs.vimPlugins.telescope-fzf-native-nvim;
|
||||||
|
lazy = false;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
config = let
|
||||||
|
extensions = mylib.generators.toLuaObject [
|
||||||
|
"undo"
|
||||||
|
"ui-select"
|
||||||
|
"fzf"
|
||||||
|
];
|
||||||
|
in ''
|
||||||
|
function(_, opts)
|
||||||
|
local telescope = require("telescope")
|
||||||
|
telescope.setup(opts)
|
||||||
|
|
||||||
|
for i, extension in ipairs(${extensions}) do
|
||||||
|
telescope.load_extension(extension)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
"<Esc>" = {__raw = ''function(...) return require("telescope.actions").close(...) end'';};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "todo-comments";
|
||||||
|
pkg = pkgs.vimPlugins.todo-comments-nvim;
|
||||||
|
lazy = false;
|
||||||
|
dependencies = [plenary];
|
||||||
|
# config = ''
|
||||||
|
# function(_, opts)
|
||||||
|
# require("todo-comments").setup(opts)
|
||||||
|
# end
|
||||||
|
# '';
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "toggleterm";
|
name = "toggleterm";
|
||||||
pkg = pkgs.vimPlugins.toggleterm-nvim;
|
pkg = pkgs.vimPlugins.toggleterm-nvim;
|
||||||
@ -645,6 +919,104 @@ in {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(let
|
||||||
|
nvim-plugintree = pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
||||||
|
p:
|
||||||
|
with p; [
|
||||||
|
bash
|
||||||
|
bibtex
|
||||||
|
c
|
||||||
|
clojure
|
||||||
|
cmake
|
||||||
|
cpp
|
||||||
|
csv
|
||||||
|
disassembly
|
||||||
|
dockerfile
|
||||||
|
dot
|
||||||
|
doxygen
|
||||||
|
fish
|
||||||
|
gitignore
|
||||||
|
haskell
|
||||||
|
haskell_persistent
|
||||||
|
html
|
||||||
|
ini
|
||||||
|
java
|
||||||
|
javascript
|
||||||
|
json
|
||||||
|
julia
|
||||||
|
kotlin
|
||||||
|
lua
|
||||||
|
make
|
||||||
|
markdown
|
||||||
|
markdown_inline
|
||||||
|
nasm
|
||||||
|
nix
|
||||||
|
objdump
|
||||||
|
org
|
||||||
|
passwd
|
||||||
|
perl
|
||||||
|
printf
|
||||||
|
python
|
||||||
|
r
|
||||||
|
regex
|
||||||
|
requirements
|
||||||
|
ruby
|
||||||
|
rust
|
||||||
|
scala
|
||||||
|
scss
|
||||||
|
sql
|
||||||
|
toml
|
||||||
|
typescript
|
||||||
|
verilog
|
||||||
|
xml
|
||||||
|
yaml
|
||||||
|
]
|
||||||
|
);
|
||||||
|
treesitter-parsers = pkgs.symlinkJoin {
|
||||||
|
name = "treesitter-parsers";
|
||||||
|
paths = nvim-plugintree.dependencies;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
name = "treesitter";
|
||||||
|
pkg = pkgs.vimPlugins.nvim-treesitter;
|
||||||
|
lazy = false;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
-- Fix treesitter grammars/parsers on nix
|
||||||
|
vim.opt.runtimepath:append("${nvim-plugintree}")
|
||||||
|
vim.opt.runtimepath:append("${treesitter-parsers}")
|
||||||
|
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
opts = {
|
||||||
|
auto_install = false;
|
||||||
|
ensure_installed = [];
|
||||||
|
parser_install_dir = "${treesitter-parsers}";
|
||||||
|
|
||||||
|
indent = {
|
||||||
|
enable = true;
|
||||||
|
# disable = ["python" "yaml"];
|
||||||
|
};
|
||||||
|
highlight = {
|
||||||
|
enable = true;
|
||||||
|
# disable = ["yaml"];
|
||||||
|
additional_vim_regex_highlighting = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Doesn't work
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true;
|
||||||
|
keymaps = {
|
||||||
|
"init_selection" = "gnn";
|
||||||
|
"node_decremental" = "grm";
|
||||||
|
"node_incremental" = "grn";
|
||||||
|
"scope_incremental" = "grc";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "trim";
|
name = "trim";
|
||||||
pkg = pkgs.vimPlugins.trim-nvim;
|
pkg = pkgs.vimPlugins.trim-nvim;
|
||||||
@ -659,6 +1031,7 @@ in {
|
|||||||
{
|
{
|
||||||
name = "trouble";
|
name = "trouble";
|
||||||
pkg = pkgs.vimPlugins.trouble-nvim;
|
pkg = pkgs.vimPlugins.trouble-nvim;
|
||||||
|
lazy = false;
|
||||||
config = ''
|
config = ''
|
||||||
function(_, opts)
|
function(_, opts)
|
||||||
require("trouble").setup(opts)
|
require("trouble").setup(opts)
|
||||||
@ -667,8 +1040,33 @@ in {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
name = "bbye";
|
name = "ufo";
|
||||||
pkg = pkgs.vimPlugins.vim-bbye;
|
pkg = pkgs.vimPlugins.nvim-ufo;
|
||||||
|
lazy = false;
|
||||||
|
dependencies = [
|
||||||
|
{
|
||||||
|
name = "promise";
|
||||||
|
pkg = pkgs.vimPlugins.promise-async;
|
||||||
|
lazy = false;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("ufo").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "which-key";
|
||||||
|
pkg = pkgs.vimPlugins.which-key-nvim;
|
||||||
|
lazy = false;
|
||||||
|
priority = 500;
|
||||||
|
config = ''
|
||||||
|
function(_, opts)
|
||||||
|
require("which-key").setup(opts)
|
||||||
|
end
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -681,7 +1079,6 @@ in {
|
|||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
]
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -698,6 +1095,11 @@ in {
|
|||||||
# enable = true;
|
# enable = true;
|
||||||
# };
|
# };
|
||||||
|
|
||||||
|
# TODO: Incremental LSP rename (noice only does search/replace incrementally)
|
||||||
|
# inc-rename = {
|
||||||
|
# enable = true;
|
||||||
|
# };
|
||||||
|
|
||||||
# TODO: Need enabled for conform fallback?
|
# TODO: Need enabled for conform fallback?
|
||||||
# lsp-format = {
|
# lsp-format = {
|
||||||
# enable = true;
|
# enable = true;
|
||||||
|
|||||||
@ -1,227 +0,0 @@
|
|||||||
{
|
|
||||||
lib,
|
|
||||||
mylib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: [
|
|
||||||
{
|
|
||||||
name = "lualine";
|
|
||||||
pkg = pkgs.vimPlugins.lualine-nvim;
|
|
||||||
lazy = false;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("lualine").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
extensions = ["fzf" "chadtree" "neo-tree" "toggleterm" "trouble"];
|
|
||||||
|
|
||||||
options = {
|
|
||||||
always_divide_middle = true;
|
|
||||||
globalstatus = true;
|
|
||||||
ignore_focus = ["neo-tree" "chadtree"];
|
|
||||||
section_separators = {
|
|
||||||
left = "";
|
|
||||||
right = "";
|
|
||||||
# left = "";
|
|
||||||
# right = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
component_separators = {
|
|
||||||
left = "";
|
|
||||||
right = "";
|
|
||||||
# left = "";
|
|
||||||
# right = "";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
sections = {
|
|
||||||
lualine_a = [
|
|
||||||
{
|
|
||||||
name = "mode";
|
|
||||||
# extraConfig = {
|
|
||||||
# separator = {
|
|
||||||
# left = "";
|
|
||||||
# };
|
|
||||||
# right_padding = "2";
|
|
||||||
# };
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lualine_b = ["branch" "diff" "diagnostics"];
|
|
||||||
lualine_c = [
|
|
||||||
{
|
|
||||||
name = "filename";
|
|
||||||
extraConfig = {
|
|
||||||
path = 1;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
lualine_x = ["filetype" "encoding" "fileformat"];
|
|
||||||
lualine_y = ["progress" "searchcount" "selectioncount"];
|
|
||||||
lualine_z = [
|
|
||||||
{
|
|
||||||
name = "location";
|
|
||||||
# extraConfig = {
|
|
||||||
# separator = {
|
|
||||||
# right = "";
|
|
||||||
# };
|
|
||||||
# left_padding = "2";
|
|
||||||
# };
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
tabline = {
|
|
||||||
lualine_a = ["buffers"];
|
|
||||||
lualine_z = ["tabs"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "noice";
|
|
||||||
pkg = pkgs.vimPlugins.noice-nvim;
|
|
||||||
dependencies = [
|
|
||||||
{
|
|
||||||
name = "nui"; # For noice
|
|
||||||
pkg = pkgs.vimPlugins.nui-nvim;
|
|
||||||
lazy = false;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lazy = false;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("noice").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
presets = {
|
|
||||||
bottom_search = false;
|
|
||||||
command_palette = true;
|
|
||||||
long_message_to_split = true;
|
|
||||||
inc_rename = true;
|
|
||||||
lsp_doc_border = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
lsp = {
|
|
||||||
documentation = {
|
|
||||||
opts = {
|
|
||||||
lang = "markdown";
|
|
||||||
replace = true;
|
|
||||||
render = "plain";
|
|
||||||
border = "rounded"; # single or rounded
|
|
||||||
format = ["{message}"];
|
|
||||||
win_options = {
|
|
||||||
concealcursor = "n";
|
|
||||||
conceallevel = 3;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
view = "hover";
|
|
||||||
};
|
|
||||||
|
|
||||||
override = {
|
|
||||||
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
|
||||||
"vim.lsp.util.stylize_markdown" = true;
|
|
||||||
"cmp.entry.get_documentation" = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
notify = {
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
popupmenu = {
|
|
||||||
enabled = true;
|
|
||||||
backend = "nui"; # cmp completion is broken
|
|
||||||
};
|
|
||||||
|
|
||||||
# cmdline.enabled = false;
|
|
||||||
# messages.enabled = false;
|
|
||||||
|
|
||||||
routes = [
|
|
||||||
# Hide inline search count info
|
|
||||||
{
|
|
||||||
filter = {
|
|
||||||
event = "msg_show";
|
|
||||||
kind = "search_count";
|
|
||||||
};
|
|
||||||
opts = {skip = true;};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "notify";
|
|
||||||
pkg = pkgs.vimPlugins.nvim-notify;
|
|
||||||
lazy = false;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
vim.notify = require("notify")
|
|
||||||
require("notify").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "telescope";
|
|
||||||
pkg = pkgs.vimPlugins.telescope-nvim;
|
|
||||||
dependencies = [
|
|
||||||
{
|
|
||||||
name = "plenary"; # For telescope
|
|
||||||
pkg = pkgs.vimPlugins.plenary-nvim;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "telescope-undo";
|
|
||||||
pkg = pkgs.vimPlugins.telescope-undo-nvim;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "telescope-ui-select";
|
|
||||||
pkg = pkgs.vimPlugins.telescope-ui-select-nvim;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "telescope-fzf-native";
|
|
||||||
pkg = pkgs.vimPlugins.telescope-fzf-native-nvim;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lazy = false;
|
|
||||||
config = let
|
|
||||||
extensions = mylib.generators.toLuaObject [
|
|
||||||
"undo"
|
|
||||||
"ui-select"
|
|
||||||
"fzf"
|
|
||||||
];
|
|
||||||
in ''
|
|
||||||
function(_, opts)
|
|
||||||
local telescope = require("telescope")
|
|
||||||
telescope.setup(opts)
|
|
||||||
|
|
||||||
for i, extension in ipairs(${extensions}) do
|
|
||||||
telescope.load_extension(extension)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
defaults = {
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
"<Esc>" = {__raw = ''function(...) return require("telescope.actions").close(...) end'';};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "which-key";
|
|
||||||
pkg = pkgs.vimPlugins.which-key-nvim;
|
|
||||||
lazy = false;
|
|
||||||
priority = 100;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("which-key").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
]
|
|
||||||
@ -1,245 +0,0 @@
|
|||||||
{
|
|
||||||
lib,
|
|
||||||
mylib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: [
|
|
||||||
{
|
|
||||||
name = "clangd-extensions";
|
|
||||||
pkg = pkgs.vimPlugins.clangd_extensions-nvim;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("clangd_extensions").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "conform";
|
|
||||||
pkg = pkgs.vimPlugins.conform-nvim;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("conform").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
formatters_by_ft = {
|
|
||||||
c = ["clang-format"];
|
|
||||||
h = ["clang-format"];
|
|
||||||
cpp = ["clang-format"];
|
|
||||||
hpp = ["clang-format"];
|
|
||||||
css = [["prettierd" "prettier"]];
|
|
||||||
html = [["prettierd" "prettier"]];
|
|
||||||
java = ["google-java-format"];
|
|
||||||
javascript = [["prettierd" "prettier"]];
|
|
||||||
lua = ["stylua"];
|
|
||||||
markdown = [["prettierd" "prettier"]];
|
|
||||||
nix = ["alejandra"];
|
|
||||||
python = ["black"];
|
|
||||||
rust = ["rustfmt"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "haskell-tools";
|
|
||||||
pkg = pkgs.vimPlugins.haskell-tools-nvim;
|
|
||||||
# Don't call setup!
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "lint";
|
|
||||||
pkg = pkgs.vimPlugins.nvim-lint;
|
|
||||||
lazy = false;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
local lint = require("lint")
|
|
||||||
|
|
||||||
for k, v in pairs(opts) do
|
|
||||||
lint[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
linters_by_ft = {
|
|
||||||
c = ["clang-tidy"];
|
|
||||||
h = ["clang-tidy"];
|
|
||||||
cpp = ["clang-tidy"];
|
|
||||||
hpp = ["clang-tidy"];
|
|
||||||
clojure = ["clj-kondo"];
|
|
||||||
java = ["checkstyle"];
|
|
||||||
javascript = ["eslint_d"];
|
|
||||||
lua = ["luacheck"];
|
|
||||||
markdown = ["vale"];
|
|
||||||
nix = ["statix"];
|
|
||||||
python = ["flake8"];
|
|
||||||
rust = ["clippy"];
|
|
||||||
text = ["vale"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "lspconfig";
|
|
||||||
pkg = pkgs.vimPlugins.nvim-lspconfig;
|
|
||||||
dependencies = [
|
|
||||||
{
|
|
||||||
name = "neodev";
|
|
||||||
pkg = pkgs.vimPlugins.neodev-nvim;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
require("neodev").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
lazy = false;
|
|
||||||
config = let
|
|
||||||
servers = mylib.generators.toLuaObject [
|
|
||||||
{name = "clangd";}
|
|
||||||
{name = "clojure_lsp";}
|
|
||||||
{name = "cmake";}
|
|
||||||
{name = "lua_ls";}
|
|
||||||
{name = "nil_ls";}
|
|
||||||
{name = "pyright";}
|
|
||||||
# {name = "rust_analyzer";} # Don't set up when using rustaceanvim
|
|
||||||
{name = "texlab";}
|
|
||||||
# {name = "hls";} # Don't set up when using haskell-tools
|
|
||||||
];
|
|
||||||
in ''
|
|
||||||
function(_, opts)
|
|
||||||
local __lspOnAttach = function(client, bufnr) end
|
|
||||||
|
|
||||||
local __lspCapabilities = function()
|
|
||||||
capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
|
|
||||||
return capabilities
|
|
||||||
end
|
|
||||||
|
|
||||||
local __setup = {
|
|
||||||
on_attach = __lspOnAttach,
|
|
||||||
capabilities = __lspCapabilities(),
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, server in ipairs(${servers}) do
|
|
||||||
if type(server) == "string" then
|
|
||||||
require("lspconfig")[server].setup(__setup)
|
|
||||||
else
|
|
||||||
local options = server.extraOptions
|
|
||||||
|
|
||||||
if options == nil then
|
|
||||||
options = __setup
|
|
||||||
else
|
|
||||||
options = vim.tbl_extend("keep", options, __setup)
|
|
||||||
end
|
|
||||||
|
|
||||||
require("lspconfig")[server.name].setup(options)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
name = "rustaceanvim";
|
|
||||||
pkg = pkgs.vimPlugins.rustaceanvim;
|
|
||||||
# Don't call setup!
|
|
||||||
}
|
|
||||||
|
|
||||||
(let
|
|
||||||
nvim-plugintree = pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
|
||||||
p:
|
|
||||||
with p; [
|
|
||||||
bash
|
|
||||||
bibtex
|
|
||||||
c
|
|
||||||
clojure
|
|
||||||
cmake
|
|
||||||
cpp
|
|
||||||
csv
|
|
||||||
disassembly
|
|
||||||
dockerfile
|
|
||||||
dot
|
|
||||||
doxygen
|
|
||||||
fish
|
|
||||||
gitignore
|
|
||||||
haskell
|
|
||||||
haskell_persistent
|
|
||||||
html
|
|
||||||
ini
|
|
||||||
java
|
|
||||||
javascript
|
|
||||||
json
|
|
||||||
julia
|
|
||||||
kotlin
|
|
||||||
lua
|
|
||||||
make
|
|
||||||
markdown
|
|
||||||
markdown_inline
|
|
||||||
nasm
|
|
||||||
nix
|
|
||||||
objdump
|
|
||||||
org
|
|
||||||
passwd
|
|
||||||
perl
|
|
||||||
printf
|
|
||||||
python
|
|
||||||
r
|
|
||||||
regex
|
|
||||||
requirements
|
|
||||||
ruby
|
|
||||||
rust
|
|
||||||
scala
|
|
||||||
scss
|
|
||||||
sql
|
|
||||||
toml
|
|
||||||
typescript
|
|
||||||
verilog
|
|
||||||
xml
|
|
||||||
yaml
|
|
||||||
]
|
|
||||||
);
|
|
||||||
treesitter-parsers = pkgs.symlinkJoin {
|
|
||||||
name = "treesitter-parsers";
|
|
||||||
paths = nvim-plugintree.dependencies;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
name = "treesitter";
|
|
||||||
pkg = pkgs.vimPlugins.nvim-treesitter;
|
|
||||||
lazy = false;
|
|
||||||
config = ''
|
|
||||||
function(_, opts)
|
|
||||||
vim.opt.runtimepath:append("${nvim-plugintree}")
|
|
||||||
vim.opt.runtimepath:append("${treesitter-parsers}")
|
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup(opts)
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
opts = {
|
|
||||||
auto_install = false;
|
|
||||||
ensure_installed = [];
|
|
||||||
parser_install_dir = "${treesitter-parsers}";
|
|
||||||
|
|
||||||
indent = {
|
|
||||||
enable = true;
|
|
||||||
# disable = ["python" "yaml"];
|
|
||||||
};
|
|
||||||
highlight = {
|
|
||||||
enable = true;
|
|
||||||
# disable = ["yaml"];
|
|
||||||
additional_vim_regex_highlighting = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: Doesn't work
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true;
|
|
||||||
keymaps = {
|
|
||||||
"init_selection" = "gnn";
|
|
||||||
"node_decremental" = "grm";
|
|
||||||
"node_incremental" = "grn";
|
|
||||||
"scope_incremental" = "grc";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
]
|
|
||||||
6
home/modules/neovim/neovide_config.ini
Normal file
6
home/modules/neovim/neovide_config.ini
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fork = true # Start neovide detached
|
||||||
|
frame = "none" # full, buttonless, none
|
||||||
|
idle = true # Don't render frames without changes
|
||||||
|
# maximized = true
|
||||||
|
title-hidden = true
|
||||||
|
# vsync = true
|
||||||
11
home/modules/neovim/vale_config.ini
Normal file
11
home/modules/neovim/vale_config.ini
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Core settings appear at the top
|
||||||
|
# (the "global" section).
|
||||||
|
|
||||||
|
[formats]
|
||||||
|
# Format associations appear under
|
||||||
|
# the optional "formats" section.
|
||||||
|
|
||||||
|
[*]
|
||||||
|
# Format-specific settings appear
|
||||||
|
# under a user-provided "glob"
|
||||||
|
# pattern.
|
||||||
@ -357,6 +357,8 @@ with mylib.networking; {
|
|||||||
wireguard-tools
|
wireguard-tools
|
||||||
man-pages
|
man-pages
|
||||||
man-pages-posix
|
man-pages-posix
|
||||||
|
|
||||||
|
# egl-wayland
|
||||||
];
|
];
|
||||||
|
|
||||||
# NOTE: Gnome
|
# NOTE: Gnome
|
||||||
|
|||||||
@ -92,12 +92,12 @@
|
|||||||
|
|
||||||
# VAAPI/VDPAU: https://nixos.wiki/wiki/Accelerated_Video_Playback
|
# VAAPI/VDPAU: https://nixos.wiki/wiki/Accelerated_Video_Playback
|
||||||
vaapiVdpau # Taken from wiki, this is also part of nixos-hardware/common/gpu/nvidia
|
vaapiVdpau # Taken from wiki, this is also part of nixos-hardware/common/gpu/nvidia
|
||||||
|
libvdpau-va-gl # Taken from wiki
|
||||||
|
|
||||||
# libvdpau-va-gl # Taken from wiki, but for Intel?
|
|
||||||
# libvdpau # NOTE: Don't know if needed/where it belongs...
|
# libvdpau # NOTE: Don't know if needed/where it belongs...
|
||||||
# libva # NOTE: Don't know if needed/where it belongs...
|
# libva # NOTE: Don't know if needed/where it belongs...
|
||||||
|
|
||||||
# nvidia-vaapi-driver # Wild guess
|
nvidia-vaapi-driver # Experimental, doesn't work with chromium
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -106,6 +106,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# environment.variables.AMD_VULKAN_ICD = "RADV"; # Choose mesa driver by default
|
# environment.variables.AMD_VULKAN_ICD = "RADV"; # Choose mesa driver by default
|
||||||
|
environment.variables = {
|
||||||
|
LIBVA_DRIVER_NAME = "nvidia";
|
||||||
|
GBM_BACKEND = "nvidia-drm";
|
||||||
|
};
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user