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

WIP: Suggested improvements #49

Open
wants to merge 81 commits into
base: vim9
Choose a base branch
from

Conversation

mmrwoods
Copy link
Contributor

@mmrwoods mmrwoods commented Nov 18, 2024

  • Remove --column from ag and rg opts, unnecessary
  • Rename ag.vim autoload script to grep.vim
  • Use smart case or ignore case with grep commands
  • Increase ASYNC_STEP to 10000, better performance
  • Add syntax highlighting for filetypes known to vim
  • Add support for fdfind (fd binary on Debian/Ubuntu)
  • Make FuzzyFiles respect .gitignore by default
  • Rename g:files_respect_gitignore to g:fuzzyy_files_respect_gitignore
  • Use git-grep as fallback for FuzzyGrep when no ag or rg found
  • Ignore binaries when using grep, git-grep, findstr
  • Rename fuzzyy_files_ignore_{file,dir} to fuzzyy_files_exclude_{file,dir}
  • Change default match hl from CurSearch to Special
  • Fix cursor restore in MacVim (don't change &guicursor, change hi-Cursor instead)
  • Fix FuzzyCommands for commands with arguments
  • Support rg for finding files when no fd installed
  • Rename enable_fuzzyy_keymaps to fuzzyy_enable_mapping
  • Remove default value for g:fuzzyy_buffers_exclude, unnecessary
  • Add custom fuzzyy highlight groups with defaults
  • Fudge smart-case for grep, git-grep, findstr
  • Fix fallback to git-grep, git-ls-files after chdir
  • Add g:fuzzyy_grep_exclude_{file,dir}, similar to g:fuzzyy_files_exclude_{file,dir}
  • Prefer rg to ag and fd for FuzzyGrep and FuzzyFiles (much faster than ag, almost as fast as fd, one less dependency)
  • Include hidden files by default, with option to disable
  • Add option to follow symlinks, disabled by default
  • Allow customisation of files and grep commands (ripgrep only)
  • Rename :FuzzyyMRUFiles to FuzzyyMru (shorter, easier to read)
  • Replace g:fuzzyy_mru_project_only with new :FuzzyyMruCwd command
  • Add fewer leader mappings by default, and only those with obvious mnemonics
  • Use preview window with :FuzzyHelps

TODO:

  • support more custom highlighting options, results cursorline, individual popup borders etc.

@mmrwoods mmrwoods force-pushed the suggested-improvements branch 15 times, most recently from 97461f4 to d691460 Compare November 24, 2024 10:45
@mmrwoods
Copy link
Contributor Author

Hi @Donaldttt,

First, thank you for Fuzzyy, it's a great plugin, I love the aim to have something that just works out of the box, that's exactly what I was looking for after using fzf.vim for years and leaderf for a while recently.

I think it's time I asked for your feedback on some of these suggested changes before going much further. They are mostly either minor bug fixes or changes aiming to improve the out of the box experience so it "just works" as expected for new users (as expected being obviously highly subjective). They are driven by my personal use over a couple of weeks and my thoughts on how this should work as a plugin I would recommend to relative newcomers to Vim (I have recommended it btw!).

If you have a little time could you take a look at let me know what you think. I don't expect you to agree with every change, but I hope I have explained each one adequately and you can understand why I've made it, if not, please let me know and I'll clarify.

Thanks!

Unnecessary as --vimgrep option ensures column numbers are included
@mmrwoods mmrwoods force-pushed the suggested-improvements branch 12 times, most recently from 5649c9c to 2c30337 Compare November 29, 2024 08:32
@mmrwoods mmrwoods force-pushed the suggested-improvements branch 8 times, most recently from cccdccd to ba2a73a Compare January 2, 2025 13:18
Add cmdhistory, colors, commands, help, and inbuffer keys to window
layout dict, with pre-existing hard-coded values for widths and xoffset.

Note that as per other keys in this dict, it does not allow complete
customisation of the window layout, only overriding of the defaults
(e.g. you cannot currently set a height for any of the selectors).
I think this was probably called "user" opts to differentiate it from
the subsets of opts extracted from this dict and passed to functions to
open the various popup windows, but I found this a confusing name, are
these different from other opts dicts, do they come from a user, how?

To avoid confusion, just use opts, a conventional name used elsewhere.
@mmrwoods mmrwoods force-pushed the suggested-improvements branch 2 times, most recently from 63d822e to 8e28ab0 Compare January 2, 2025 16:47
This doesn't help readability unless the operators are aligned
Previously only window layout options that had been explicitly specified
could be overridden. This change allows any window layout option set in
in g:fuzzyy_window_layout to be passed down when creating the windows.
@mmrwoods mmrwoods force-pushed the suggested-improvements branch from 8e28ab0 to 7c466f2 Compare January 3, 2025 08:04
These should probably generate warnings, but ignoring is at least better
than using invalid values for calculating the popup_create() arguments.
By convention this should match the plugin name to avoid name clashes,
and to make it clear which plugins autoload functions are loaded from.
Avoid name clashes or naming confusion with other plugins
@mmrwoods mmrwoods force-pushed the suggested-improvements branch from d349028 to 01589f2 Compare January 3, 2025 09:21
This makes it easier to deal with multiple options for a selector, like
passing both a working directory and search keywords to grep.Start()

I want to do this for a custom FuzzyyGrepRoot command, which will
require adding an optional cwd argument to grep.Start(). Adding more
positional arguments to support new requirements like this is fugly.
This allows abuse like:

command! -nargs=? FuzzyGrepRepo call fuzzyy#grep#Start({'cwd': trim(system('git rev-parse --show-toplevel')), 'search': <q-args> })

But that abuse should be considered likely to break, these exported
autolood functions are not intended as a public Fuzzyy API (but at some
point it would be nice to have a documented API like telescope.nvim)
@mmrwoods mmrwoods mentioned this pull request Jan 5, 2025
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

Successfully merging this pull request may close these issues.

2 participants