all repos — dotfiles @ a1473167a4f0d7628a0a6127c9029ad5187bcc43

my *nix dotfiles

nvim: Add helper function to ignore dirs in fzy
Anirudh Oppiliappan x@icyphox.sh
Mon, 01 Feb 2021 17:08:47 +0530
commit

a1473167a4f0d7628a0a6127c9029ad5187bcc43

parent

f8a3495f83ae4779ed0c28baa44bd1d1c0fb3cfb

1 files changed, 19 insertions(+), 2 deletions(-)

jump to
M config/nvim/lua/maps.luaconfig/nvim/lua/maps.lua

@@ -19,15 +19,32 @@ cmd(':command! Wqa wqa')

cmd(':command! W w') cmd(':command! Q q') +local function fzy_ignore(patterns) + pattern_cmd = {} + for _, p in ipairs(patterns) do + table.insert(pattern_cmd, string.format("! -path '%s'", p)) + end + + return table.concat(pattern_cmd, ' ') +end + -- fzy mappings if vim.fn.executable('fzy') then _G.fzy = require('fzy').fzy map( '', '<leader>e', - ':call v:lua.fzy("find -L . -type f ! -path \'*.git/*\'", ":e")<cr>', + -- TODO: Rework this directory ignores into a table + string.format( + ':call v:lua.fzy("find -L . -type f %s", ":e")<cr>', + fzy_ignore({'*.git/*', '*node_modules*'}) + ), { noremap=true, silent=true } ) + + --map('', + --'<leader>f', + --'') else - print(' not in PATH!') + print('fzy not in PATH!') end