Skip to content

Commit

Permalink
chore: add precommits
Browse files Browse the repository at this point in the history
  • Loading branch information
sphamba committed Nov 27, 2024
1 parent 2117774 commit 3f51372
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 14 deletions.
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v2.0.1
hooks:
- id: stylua-github
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
install:
pre-commit install -t pre-commit -t commit-msg

lint:
pre-commit run --all-files
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,22 @@ lua require('smear_cursor').cursor_color = '#d3cdc3'
- No smear when buffer is duplicated
- No smear outside buffer (further than the last line)
- No smear through wrapped lines


# Contributing

Please feel free to open an issue or a pull request if you have any suggestions or improvements!
This project uses [pre-commit](https://pre-commit.com/) hooks to ensure code quality (with [StyLua](https://github.com/JohnnyMorganz/StyLua)) and meaningful commit messages (following [Conventional Commits](https://www.conventionalcommits.org/))


## Requirements

- Neovim >= 0.10.2
- Make
- pre-commit (`pip install pre-commit`)


## Setup

1. Clone the repository
2. Run `make install` to install the pre-commit hooks
4 changes: 2 additions & 2 deletions lua/smear_cursor/draw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ M.draw_line = function(row_start, col_start, row_end, col_end, end_reached)
if L.slope_abs <= config.max_slope_horizontal then
-- logging.debug("Drawing horizontal-ish line")
-- if math.abs(L.row_shift) > 1 then
-- -- Avoid bulding on thin lines
-- -- Avoid bulging on thin lines
-- L.thickness = math.max(L.thickness, 1)
-- end
draw_horizontal_ish_line(L, draw_vertically_shifted_block)
Expand All @@ -447,7 +447,7 @@ M.draw_line = function(row_start, col_start, row_end, col_end, end_reached)
if L.slope_abs >= config.min_slope_vertical then
-- logging.debug("Drawing vertical-ish line")
-- if math.abs(L.col_shift) > 1 then
-- -- Avoid bulding on thin lines
-- -- Avoid bulging on thin lines
-- L.thickness = math.max(L.thickness, 1)
-- end
draw_vertical_ish_line(L, draw_horizontally_shifted_block)
Expand Down
4 changes: 2 additions & 2 deletions stylua.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
indent_type = "Tabs"
indent_width = 2
indent_width = 4
column_width = 120

[sort_requires]
enabled = true

15 changes: 5 additions & 10 deletions tests/test.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-- Instructions: open this file in Neovim and run `source %`


local foldable_lines = {
{
"Hello",
Expand All @@ -21,8 +20,6 @@ local foldable_lines = {

-- Line with 🎉 emoji



-- Also test:
-- - Popup menus
-- - Sidebar
Expand All @@ -47,7 +44,6 @@ local foldable_lines = {
-- ───────────────┘│
-- 4───1───2───3───4


-- This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very long line.

--
Expand Down Expand Up @@ -80,7 +76,6 @@ local foldable_lines = {
-- ....
--


local buffer_id = vim.api.nvim_get_current_buf()
local ns = vim.api.nvim_create_namespace("smear_cursor_test")
vim.api.nvim_buf_clear_namespace(buffer_id, ns, 0, -1)
Expand All @@ -93,27 +88,27 @@ vim.cmd([[
]])

vim.api.nvim_buf_set_extmark(buffer_id, ns, 15, 0, {
virt_lines = {{{"Extmark above", "Question"}}},
virt_lines = { { { "Extmark above", "Question" } } },
virt_lines_above = true,
})

vim.api.nvim_buf_set_extmark(buffer_id, ns, 16, 0, {
virt_text = {{"*", "Question"}},
virt_text = { { "*", "Question" } },
virt_text_pos = "eol",
})

vim.api.nvim_buf_set_extmark(buffer_id, ns, 17, 10, {
virt_text = {{"*", "Question"}},
virt_text = { { "*", "Question" } },
virt_text_pos = "overlay",
})

vim.api.nvim_buf_set_extmark(buffer_id, ns, 18, 10, {
virt_text = {{"*", "Question"}},
virt_text = { { "*", "Question" } },
virt_text_pos = "inline",
})

vim.api.nvim_buf_set_extmark(buffer_id, ns, 19, 0, {
virt_lines = {{{"Extmark below", "Question"}}},
virt_lines = { { { "Extmark below", "Question" } } },
})

local function create_float(content, row, col)
Expand Down

0 comments on commit 3f51372

Please sign in to comment.