Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep history of searches #96

Open
maximbaz opened this issue Oct 22, 2018 · 2 comments
Open

Keep history of searches #96

maximbaz opened this issue Oct 22, 2018 · 2 comments

Comments

@maximbaz
Copy link

maximbaz commented Oct 22, 2018

FZF has a very interesting feature, it remembers all your searches and allows you to scroll them to repeat past search.

For example, suppose you use zsh-fzy (you really should merge #58, btw 😉) and you want to select two files that both match your filter "myverylongfilter".

Ideal way of course is to use multiple selection (#93) and just select both files at once, but you could have also selected a file, then fire up fzy again and press a shortkey to bring up the last search instead of typing "myverylongfilter" again.

The relevance of this request really depends on your decision about multiple selection (#93), if it gets implemented the need for history will become much smaller for me.

@stefanos82
Copy link

I don't know @maximbaz whether it's related to your question or not, but I have a request on a similar concept: I have a project that is located at /home/stefanos/code/ and in it I have multiple folders with subfolders that contain files.

If I open a file which is located at, let's say /home/stefanos/code/folder-a/foo.php, I cannot go back to /home/stefanos/code and look for another file or folder.

I guess my issue is more related to Vim's script than fzy's.

@stefanos82
Copy link

stefanos82 commented Oct 25, 2018

I have solve it by doing something simple.

I have changed the original Vim sample as follows:

function! FzyCommand(choice_command, vim_command)
  try
    let output = system(a:choice_command . " | fzy ")
  catch /Vim:Interrupt/
    " Swallow errors from ^C, allow redraw! below
  endtry
  redraw!
  if v:shell_error == 0 && !empty(output)
    exec a:vim_command . ' ' . output
  endif
endfunction

let findcwd = "find " . expand('%:p:h') . " -type f"
nnoremap <leader>e :call FzyCommand(findcwd, ":e")<cr>
nnoremap <leader>v :call FzyCommand(findcwd, ":vs")<cr>
nnoremap <leader>s :call FzyCommand(findcwd, ":sp")<cr>

This works exactly as I wanted it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants