Closed jtourlamain closed 2 years ago
@jtourlamain Could you describe more exactly what you mean/are looking for telescope to do? Maybe a link to the telescope documentation of what customization you want to make?
@mehalter when searching for files in a project, I don't want to see dll files, files in the obj or bin folder,... So I've put the follogin in my user/settings.lua file:
polish = function()
local opts = { noremap = true, silent = true }
local map = vim.api.nvim_set_keymap
local set = vim.opt
-- Set options
set.relativenumber = true
set.wildignore = [[
.git,.hg,.svn
*.aux,*.out,*.toc
*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
*.mp3,*.oga,*.ogg,*.wav,*.flac
*.eot,*.otf,*.ttf,*.woff
*.doc,*.pdf,*.cbr,*.cbz
*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
*.swp,.lock,.DS_Store,._*
*/tmp/*,*/obj/*,*/bin/*,*.so,*.swp,*.zip,**/node_modules/**,**/target/**,**.terraform/**"
]]
-- Set key bindings
map("n", "<C-s>", ":w!<CR>", opts)
-- Set autocommands
vim.cmd [[
augroup packer_conf
autocmd!
autocmd bufwritepost plugins.lua source <afile> | PackerSync
augroup end
]]
end,
@jtourlamain Telescope has a separate configuration for file ignore patterns. Not sure if you can make it use wildignore
. You can achieve this with the following code added to the overrides
table in settings.lua
:
overrides = {
telescope = {
defaults = {
file_ignore_patterns = {
".git",
".hg",
".svn",
"*.aux",
"*.out",
"*.toc",
"*.o",
"*.obj",
"*.exe",
"*.dll",
"*.manifest",
"*.rbc",
"*.class",
"*.ai",
"*.bmp",
"*.gif",
"*.ico",
"*.jpg",
"*.jpeg",
"*.png",
"*.psd",
"*.webp",
"*.avi",
"*.divx",
"*.mp4",
"*.webm",
"*.mov",
"*.m2ts",
"*.mkv",
"*.vob",
"*.mpg",
"*.mpeg",
"*.mp3",
"*.oga",
"*.ogg",
"*.wav",
"*.flac",
"*.eot",
"*.otf",
"*.ttf",
"*.woff",
"*.doc",
"*.pdf",
"*.cbr",
"*.cbz",
"*.zip",
"*.tar.gz",
"*.tar.bz2",
"*.rar",
"*.tar.xz",
"*.kgb",
"*.swp",
".lock",
".DS_Store",
"._*",
"*/tmp/*",
"*/obj/*",
"*/bin/*",
"*.so",
"*.swp",
"*.zip",
"**/node_modules/**",
"**/target/**",
"**.terraform/**",
},
},
},
}
@mehalter thx a lot! It works
Sorry to reopen. Where is this settings.lua file you are talking about. I have the init.lua file in my user directory, but I don't know where to add the above configuration to.
@ErnieBernie10 since release 1.0 the lua/user/settings.lua file is renamed to lua/user/init.lua. Keep in mind that now you need to create the directory user (cf their readme: https://github.com/kabinspace/AstroVim#%EF%B8%8F-configuration) In the file lua/user/init.lua you can use:
plugins = {
telescope = {
defaults = {
file_ignore_patterns = {
".git",
-- all your ignore settings come here
"**.terraform/**",
},
},
},
}
Thanks for the reply! After I added this configuration telescope just broke entirely and doesn't show any files.
I don't know if it's possible to make telescope use the wildignore settings that can be defined in the user/settings.lua? Now it seems that telescope displays all files while searching. Or is there another way to set it in the user/settings.lua file?