~whynothugo/dotfiles

9bf1031e1df4cfabaf645a187e504fe4f909e56b — Hugo Osvaldo Barrera 24 days ago 2b6cb2f
nvim: Exclude current file from fzf picker
1 files changed, 13 insertions(+), 2 deletions(-)

M home/.config/nvim/lua/mappings.lua
M home/.config/nvim/lua/mappings.lua => home/.config/nvim/lua/mappings.lua +13 -2
@@ 74,8 74,19 @@ vim.keymap.set("n", "<C-l>", [[:vertical resize +1<CR>]], { silent = true })
-- always included.
--
-- TODO: It'd be great if files in pwd are weighted higher.
-- TODO: Exclude current file from prompt: https://github.com/ibhagwan/fzf-lua/issues/396
vim.keymap.set("n", "<Leader>p", require("fzf-lua").files, { silent = true })
vim.keymap.set("n", "<Leader>p", function()
  -- Exclude currently focused file from the list:
  local current = vim.fn.expand("%")

  local cmd
  if current ~= "" then
    cmd = string.format("fd --exclude %s", vim.fn.shellescape(current))
  else
    cmd = "fd"
  end

  require("fzf-lua").files({ cmd = cmd })
end)

local function breakPoint()
  local ft = vim.bo.filetype