diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-11-01 22:51:33 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-11-01 22:51:33 +0200 |
| commit | 81e2925092cdb6fe21791b32f6c6983b4e31b3d7 (patch) | |
| tree | bb6d5a25f8eb8e262914f33ec07b366c7ba5be88 /lua/plugins | |
| parent | 5bfddf88b927f2591dde63db2b4c1fff75975448 (diff) | |
| download | dotfiles-81e2925092cdb6fe21791b32f6c6983b4e31b3d7.tar.gz dotfiles-81e2925092cdb6fe21791b32f6c6983b4e31b3d7.zip | |
find_config() now tracks dotfiles (bare git repository), no need to manually add config files to search
Diffstat (limited to 'lua/plugins')
| -rw-r--r-- | lua/plugins/telescope.lua | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 5b9717b..fb1b3ee 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -311,50 +311,24 @@ require('telescope').load_extension('recent_files') --end function M.find_configs() + -- Track dotfiles (bare git repository) + -- Inside shell config file: + -- alias config='git --git-dir=$HOME/.cfg --work-tree=$HOME' + -- cfg_files=$(config ls-tree --name-only -r HEAD) + -- export CFG_FILES="$cfg_files" + local tracked_files = {} + + for file in string.gmatch(os.getenv('CFG_FILES'), '[^\n]+') do + table.insert(tracked_files, os.getenv('HOME') .. '/' .. file) + end + require('telescope.builtin').find_files({ hidden = true, no_ignore = false, prompt_title = ' Find Configs', results_title = 'Config Files', path_display = { 'smart' }, - search_dirs = { - '~/.vim', - '~/.config/nvim', - '~/.config/zsh', - '~/.config/tmux', - '~/.config/X11', - '~/.config/alacritty', - '~/.config/kitty', - '~/.config/wezterm', - '~/.config/bspwm', - '~/.config/sxhkd', - '~/.config/picom', - '~/.config/polybar', - '~/.bashrc', - '~/.profile', - '~/.zprofile', - '~/.gitconfig', - '~/.gitsubtrees', - '~/.gitignore', - '~/.editorconfig', - '~/.prettierrc.yml', - '~/.ssh', - '~/README.md', - '~/.config/inputrc', - }, - file_ignore_patterns = { - '/nvim/startup.log', - 'zsh/plugins', - 'packer_compiled.lua', - 'resurrect', - 'tmux/plugins', - --"^~/.config/tmux/plugins", - '%.txt', - '.git/', - 'autoload/plugged', - 'plug.vim', - 'zcompdump', - }, + search_dirs = tracked_files, layout_strategy = 'horizontal', layout_config = { preview_width = 0.65, width = 0.75 }, }) |
