Skip to content

Commit

Permalink
feat(snacks): replace vim-illuminate with words module
Browse files Browse the repository at this point in the history
- still some bug, e.g. highlight not disabled when cursor leave a word
  • Loading branch information
WilliamHsieh committed Dec 25, 2024
1 parent 5c5f022 commit ee93922
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 44 deletions.
1 change: 0 additions & 1 deletion config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
"vim-matchup": { "branch": "master", "commit": "5fb083de1e06fdd134c6ad8d007d4b5576b25ba7" },
"vim-startuptime": { "branch": "master", "commit": "ac2cccb5be617672add1f4f3c0a55ce99ba34e01" },
"vim-tpipeline": { "branch": "master", "commit": "5f663e863df6fba9749ec6db0a890310ba4ad0a9" },
Expand Down
1 change: 0 additions & 1 deletion config/nvim/lua/plugins/catppuccin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function M.config()
cmp = true,
gitsigns = true,
hop = true,
illuminate = true,
leap = true,
lsp_saga = true,
lsp_trouble = true,
Expand Down
41 changes: 0 additions & 41 deletions config/nvim/lua/plugins/illuminate.lua

This file was deleted.

26 changes: 25 additions & 1 deletion config/nvim/lua/plugins/snacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ return {

---@type snacks.config
opts = {
words = {
enabled = true,
debounce = 150,
},
bigfile = { enabled = true },
notifier = { enabled = true },
quickfile = { enabled = true },
Expand Down Expand Up @@ -37,10 +41,30 @@ return {
},

init = function()
local snacks = require("snacks")

vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesActionRename",
callback = function(event)
require("snacks").rename.on_rename_file(event.data.from, event.data.to)
snacks.rename.on_rename_file(event.data.from, event.data.to)
end,
})

local set_jump_words_keymap = function(buffer)
local opts = buffer and { buffer = buffer } or nil
vim.keymap.set({ "n", "t" }, "]]", function()
snacks.words.jump(vim.v.count1)
end, opts)
vim.keymap.set({ "n", "t" }, "[[", function()
snacks.words.jump(-vim.v.count1)
end, opts)
end

vim.schedule(set_jump_words_keymap)
vim.api.nvim_create_autocmd("FileType", {
callback = function()
local buffer = vim.api.nvim_get_current_buf()
set_jump_words_keymap(buffer)
end,
})
end,
Expand Down

0 comments on commit ee93922

Please sign in to comment.