Skip to content

feat!: support replace mode, new colors and improve performance via caching #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6dd7d02
refactor!: all the things
mvllow Jun 9, 2024
3b5f8aa
Merge branch 'main' into canary
mvllow Jun 9, 2024
4d104b5
feat: remove unnecessary cursorline toggle
mvllow Jun 10, 2024
af3f1c0
fix: modes disabled when returning from ignored buffer
mvllow Jun 10, 2024
b2f5c83
feat: remove extraneous event listener
mvllow Jun 10, 2024
80dd50b
chore: remove validate
mvllow Jun 11, 2024
020089d
feat: extend respective base highlight groups
mvllow Jun 11, 2024
8a0d188
feat: re-add augroup management
mvllow Jun 11, 2024
0875ed1
fix: circular reference
mvllow Jul 24, 2024
76a29e4
chore: update package loading
mvllow Aug 6, 2024
5993925
docs: add syntax language
mvllow Aug 6, 2024
abcafa6
chore: remove autoloading
mvllow Dec 9, 2024
0e28d13
docs: add license
mvllow Dec 9, 2024
a83ea1a
feat(perf): cache colors and scenes
mvllow Jan 2, 2025
7c09faa
feat(docs): update doc gen
mvllow Jan 2, 2025
da8b76b
fix(perf): prevent autocmd from being recreated over and over
mvllow Jan 2, 2025
4a1f489
feat: improve background color detection and caching
mvllow Jan 16, 2025
6ce6422
chore: add `Make clean`
mvllow Jan 16, 2025
bbdbddd
fix: operator pending detection
mvllow Feb 21, 2025
77a501f
feat!: update config structure
mvllow Feb 21, 2025
74a5f4c
refactor: apply configuration
mvllow Feb 22, 2025
9000b4d
refactor: abstract scene name
mvllow Feb 22, 2025
138da56
fix: remove static highlights
mvllow Feb 22, 2025
f23d0e4
refactor: rename functions and format
mvllow Feb 22, 2025
f5842ec
docs: remove deprecated config
mvllow Feb 22, 2025
705b983
feat: extend cursorline background
mvllow Feb 23, 2025
9bed83c
temp: remove winhighlight cache
mvllow Feb 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true

[*.lua]
indent_size = 3
indent_style = tab
3 changes: 0 additions & 3 deletions .stylua.toml

This file was deleted.

23 changes: 7 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
DEPENDENCIES_DIR:=dependencies
DEPENDENCIES_VENDOR:=${DEPENDENCIES_DIR}/pack/vendor
NVIM_HEADLESS:=nvim --headless --noplugin --clean -u tests/minimal.vim

.PHONY: install_dependencies
install_dependencies:
test -r ${DEPENDENCIES_VENDOR}/start/plenary.nvim || git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git ${DEPENDENCIES_VENDOR}/start/plenary.nvim

.PHONY: clear_dependencies
clear_dependencies:
rm -rf "${DEPENDENCIES_DIR}"
.PHONY: docs
docs:
@echo "Generating documentation..."
@nvim --headless --noplugin -u ./scripts/minimal-init.lua -c "luafile scripts/minidoc.lua" -c "qa!"

.PHONY: clean
clean: clear_dependencies

.PHONY: test
test: install_dependencies
$(NVIM_HEADLESS) -c "call Test()"
clean:
@echo "Removing temporary directories..."
@rm -rf "/tmp/nvim/site/pack/test/start/mini.doc"
61 changes: 61 additions & 0 deletions doc/modes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
*modes.nvim* Prismatic line decorations for the adventurous vim user
*Modes*

MIT License Copyright (c) mvllow

==============================================================================

Features:

- Highlight UI elements based on the current mode.

Manage module status:

- |Modes.enable()|
- |Modes.disable()|
- |Modes.toggle()|

# Setup ~

Modes setup can be called with your `config` table to modify default
behaviour.

See |Modes.config| for `config` options and default values.

------------------------------------------------------------------------------
*Modes.setup()*
`Modes.setup`({config})
Module setup

Parameters ~
{config} `(table|nil)` Module config table. See |Modes.config|.

Usage ~
`require('modes').setup({})` (replace `{}` with your `config` table)

------------------------------------------------------------------------------
*Modes.config*
`Modes.config`
Module config

Default values:
>lua
Modes.config = {
copy = { enable = true, color = nil, opacity = 0.15 },
delete = { enable = true, color = nil, opacity = 0.15 },
insert = { enable = true, color = nil, opacity = 0.15 },
replace = { enable = true, color = nil, opacity = 0.15 },
visual = { enable = true, color = nil, opacity = 0.15 },
ui = {
cursor = true,
cursorline = true,
modemsg = true,
number = true,
signcolumn = true,
},
-- Unlisted buffers are ignored by default
ignore_filetypes = {},
}
<

vim:tw=78:ts=8:noet:ft=help:norl:
4 changes: 4 additions & 0 deletions doc/tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Modes modes.txt /*Modes*
Modes.config modes.txt /*Modes.config*
Modes.setup() modes.txt /*Modes.setup()*
modes.nvim modes.txt /*modes.nvim*
21 changes: 21 additions & 0 deletions license
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 mvllow

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading