(fn get-files-recursive [directory files]
  (let [curdir vim.env.PWD
        directory-files (vim.fn.readdir directory)
        ignored-dirs ["." ".." ".git" "build" "bin" "plugins"]]
    (each [_ file (ipairs directory-files)]
      (let [full-path (.. directory "/" file)]
        (if (and (not= 0 (vim.fn.isdirectory full-path)) (not (vim.tbl_contains ignored-dirs file)))
            (get-files-recursive full-path files)
            (table.insert files (full-path:sub (+ 2 (length curdir)))))))
    files)

  (var file-cache nil)

  (vim.api.nvim_create_user_command "F"
                                    (lambda [opts]
                                      (vim.cmd.tabnew (. opts.fargs 1)))
                                    { :nargs 1
                                      :bars true
                                      :complete
                                        (lambda [trigger]
                                          (if (not file-cache)
                                              (set file-cache (get-files-recursive vim.env.PWD {})))
                                          (if (> (length trigger) 0)
                                              (vim.fn.matchfuzzy file-cache trigger)
                                              file-cache)) }))