mini visits - only track files in the current dir or its children #621
-
I tend to use goto-definition a lot to look at system libraries and things - what is the simplest way to have mini.visits only track files that are children of PWD and not ignored in git? |
Beta Was this translation helpful? Give feedback.
Answered by
echasnovski
Dec 17, 2023
Replies: 1 comment
-
There are at least two approaches here:
local visits = require('mini.visits')
local default_normalize = visits.gen_normalize.default()
local normalize = function(index)
for cwd, cwd_tbl in pairs(index) do
for path, _ in pairs(cwd_tbl) do
if not vim.startswith(path, cwd) then cwd_tbl[path] = nil end
end
end
return default_normalize(index)
end
visits.setup({ store = { normalize = normalize } }) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
echasnovski
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are at least two approaches here:
BufAdd
which setsvim.b.minivisits_disable
if it doesn't fit requirements for being tracked. This is doable and does directly what you want.config.store.normalize
function which removes unwanted path entries. This looks like a slightly cleaner and more performant approach, but it means that unwanted paths will be in index before normalization is done (during writing to disk or manually callingnormalize()
). Here is a snippet which removes non-children entries: