Skip to content
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

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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"
70 changes: 70 additions & 0 deletions doc/modes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
*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 = {
---@type table<string, string|nil>
colors = {
bg = nil,
copy = nil,
delete = nil,
insert = nil,
replace = nil,
visual = nil,
},
-- Unlisted buffers are ignored by default
ignore_filetypes = {},
line_opacity = {
copy = 0.15,
delete = 0.15,
insert = 0.15,
replace = 0.15,
visual = 0.15,
},
set_cursor = true,
set_cursorline = true,
set_modemsg = true,
set_number = true,
set_signcolumn = true,
}
<

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