Git Product home page Git Product logo

ferret's Introduction

"dotfiles" and system configuration

These dotfiles are affectionately dedicated to the vi editor originally created by Bill Joy, with whom I have spent many pleasant evenings1

โ€” Greg Hurrell, paraphrasing Donald Knuth

Overview

Features

Dotfiles

A set of dotfiles that I've been tweaking and twiddling since the early 2000s (under version control since 2009). Characteristics include:

  • Sane Vim pasting via bracketed paste mode.
  • Write access to local clipboard from local and remote hosts, inside and outside of tmux (via Clipper).
  • Full mouse support (pane/split resizing, scrolling, text selection) in Vim and tmux.
  • Focus/lost events for Vim inside tmux.
  • Cursor shape toggles on entering Vim.
  • Italics in the terminal.
  • Bundles a (not-excessive) number of useful Vim plug-ins.
  • Conservative Vim configuration (very few overrides of core functionality; most changes are unobtrusive enhancements; some additional functionality exposed via <Leader> and <LocalLeader> mappings.
  • Relatively restrained Zsh config, Bash-like but with a few Zsh perks, such as right-side prompt, auto-cd hooks, command elapsed time printing and such.
  • Unified color-handling (across Kitty and Vim) via Base16 Shell.
  • Encrypted versioning of files with sensitive content (via git-cipher).
  • Comprehensive Hammerspoon config.

Homebrew

On macOS, the "homebrew" aspect installs a bunch of useful software.

Keyboard customization

On macOS, we use Karabiner-Elements, and on Linux, we use Interception Tools and a few other pieces to make the following changes:

  • Make Caps Lock serve as Backspace (when tapped) and Left Control (when chorded with another key). When held down alone, Caps Lock fires repeated Backspace events.
  • Make Return serve as Return (when tapped) and Right Control (when chorded with another key). When held down alone, Return fires repeated Return events.
  • Toggle Caps Lock on by tapping both Shift keys simultaneously.
  • Makes the function keys on my external Realforce keyboard behave like the "media" keys on Apple's keyboards.

And these only on macOS:

  • Swap Option and Command keys on my external Realforce keyboard.
  • Make the "application" key (extra modifier key on right-hand side) behave as "fn" on Realforce keyboard.
  • Map Control-I to F6 (only in the terminal) so that it can be mapped independently from Tab in Vim2.
  • Make "pause" (at far-right of function key row) behave as "power" (effectively, sleep) on Realforce keyboard.
  • Adds a "SpaceFN" layer that can be activated by holding down Space while hitting other keys; I use this to make the cursor keys available on or near the home row in any app.

Zsh

Functions

  • ag: Transparently wraps the ag executable so as to provide a centralized place to set defaults for that command (seeing as it has no "rc" file).
  • bounce: bounce the macOS Dock icon if the terminal is not in the foreground.
  • color: change terminal and Vim color scheme.
  • fd: "find directory" using fast bfs and sk; automatically cds into the selected directory.
  • fh: "find [in] history"; selecting a history item inserts it into the command line but does not execute it.
  • history: overrides the (tiny) default history count.
  • jump (aliased to j): to jump to hashed directories.
  • regmv: bulk-rename files (eg. regmv '/\.tif$/.tiff/' *).
  • scratch: create a random temporary scratch directory and cd into it.
  • tick: moves an existing time warp (eg. tick +1h); see tw below for a description of time warp.
  • tmux: wrapper that reattches to pre-existing sessions, or creates new ones based on the current directory name; additionally, looks for a .tmux file to set up windows and panes (note that the first time a given .tmux file is encountered the wrapper asks the user whether to trust or skip it).
  • tw ("time warp"): overrides GIT_AUTHOR_DATE and GIT_COMMITTER_DATE (eg. tw -1d).

Prompt

Zsh is configured with the following prompt:

Visible here are:

  • Concise left-hand prompt consisting of:
  • Extended right-hand size prompt which auto-hides when necessary to make room for long commands and contains:
    • Duration of previous command in adaptive units (seconds, minutes, hours, days, depending on duration).
    • Current version control branch name.
    • Current version control worktree status using colors that match those used in git status:
      • Green dot indicates staged changes.
      • Red dot indicates unstaged changes.
      • Blue dot indicates untracked files.
    • Full version of current working directory (again, abbreviating $HOME to ~).

Nested shells are indicated with additional prompt characters. For example, one nested shell:

Two nested shells:

Root shells are indicated with a different color prompt character and the word "root":

Nesting within a root shell is indicated like this:

Two nested shells:

If the last command exited with a non-zero status (usually indicative of an error), a yellow exclamation is shown:

If there are background processes, a yellow asterisk is shown:

Dependencies

Platform status

Platform Status
macOS ๐Ÿฅ‡ Currently the most tested platform, as well as the one with most aspects (because my daily driver is macOS 13 "Sonoma")
Arch Linux ๐Ÿฅˆ Less tested, fewer aspects involved, but likely to evolve in the future as I'm using Arch Linux on my "leisure" desktop machine
Red Hat Linux and related (eg. CentOS) ๐Ÿ’€ Abandoned, but in the past (2011-2018) this was the distro I used full-time at work

Installation

Clone

Development occurs on the main branch, but to avoid inconvenience for people who previously cloned the repo when the master branch was the main line, the legacy branch is kept up-to-date via a pre-push hook (which updates the local branch) and a post-receive hook (which updates the remote).

macOS

git clone --recursive https://github.com/wincent/wincent.git

Arch Linux

sudo pacman -Syu
sudo pacman -S git ruby tmux vim
git clone --recursive https://github.com/wincent/wincent.git
  • git: In order to clone the repo.
  • ruby: So that git-cipher can run (also used to build Command-T).
  • tmux: Just for comfort (eg. so you can see scrollback).
  • vim: Because the nvim aspect needs Vim (it runs vim to do a :helptags update).

Install

โš ๏ธ WARNING: There are lots of different things that can be installed or configured (see the aspects/ directory). Unless you want your machine to be exactly like mine โ€” which is unlikely โ€” you probably don't want to install everything. Maybe you don't even want everything in the "dotfiles" and "nvim" aspects. Please inspect the contents of each aspect before proceeding to install it; you may even be better off just looking at the configuration files and stealing the bits that you find interesting or useful (everything is in the public domain, unless otherwise indicated).

At the time of writing, these are the aspects, which you can expect to change over time (see the aspects/ directory for an up-to-date listing):

  • On macOS only:
    • automator: Scripts for use with Automator
    • automount: Sets up macOS's automount facility
    • backup: Backup scripts
    • cron: Sets up cron files
    • defaults: Sets up defaults (ie. preferences) on macOS
    • fonts: Installs Source Code Pro font files
    • homebrew: Installs and updates Homebrew
    • karabiner: Configures Karabiner-Elements (keyboard customization).
    • launchd: Configures launchd
    • nix: Installs packages via the Nix package manager.
    • node: Installs Node.js
    • ruby: Installs Ruby gems
    • ssh: Manages local SSH config
    • violentmonkey: Sets up UserScripts
  • On Linux only:
    • apt: Installs packages using apt-get.
    • aur: Installs packages from the Arch User Repository.
    • avahi: Manages the Avahi zeroconf ("Bonjour") networking daemon.
    • interception: Sets up Interceptions Tools (keyboard customization).
    • locale: Sets up /etc/locale.conf
    • pacman: Installs packages via the Pacman package manager
    • sshd: Manages sshd.
    • systemd: Set up services that run from systemd
  • On both macOS and Linux:
    • dotfiles: Creates symlinks in $HOME to the dotfiles in this repo
    • meta: Tests the configuration framework
    • shell: Sets the use shell to zsh
    • terminfo: Sets up terminfo database entries for italics and 256-color support
    • nvim: Configures Neovim and Vim

Examples

./install dotfiles nvim     # Just install "dotfiles" and "nvim" stuff.
./install dotfiles          # Just install "dotfiles".
./install dotfiles --step   # Prompt for confirmation at each step.
./install dotfiles --check  # Do a dry-run, showing what would be changed.
./install                   # Install everything.
./install ^homebrew         # Install everything except for the "homebrew" aspect.
./install --help            # Lists all aspects, descriptions, options.

This sets up a local Node environment using n, and then uses Fig to copy the dotfiles and configure the machine.

Note: Given that ~/.config/git/config is included with these dotfiles, any local modifications or overrides that you apply should be added to ~/.config/git/config.local instead; for example:

git config --file ~/.config/git/config.local user.name "John Doe"
git config --file ~/.config/git/config.local user.email [email protected]

Troubleshooting

General troubleshooting

There are a few useful ./install options:

# Run in "check" (dry-run) mode.
./install --check

# Show debugging information during the run.
./install --debug

# Confirm each task before running it (--step), and begin
# execution from a specific task (--start-at-task) in a
# specific aspect ("dotfiles").
./install --step --start='make directories' dotfiles

./install hangs on the first run

If running on a brand new OS install where you have never used sudo before, ./install may appear to hang after requesting your password. This is because sudo may show a "lecture"3 on first run that requires you to respond to a prompt. When running in the context of ./install, you never see this prompt, because sudo is running in a subprocess, which causes the run to hang.

To avoid this, one time only, run sudo -v before running ./install.

License

Unless otherwise noted, the contents of this repo are in the public domain. See the LICENSE for details.

Authors

The repo is written and maintained by Greg Hurrell <[email protected]>. Other contributors that have submitted patches include, in alphabetical order:

  • Anton Kastritskiy
  • Hashem A. Damrah
  • Joe Lencioni
  • Jonathan Wilkins
  • Keng Kiat Lim
  • Mark Stenglein
  • Matthew Byrne
  • Michael Lohmann
  • Stone C. Lasley
  • Victor Igor
  • Zac Collier

This list produced with:

:read !git shortlog -s HEAD | grep -v 'Greg Hurrell' | cut -f 2-3 | sed -e 's/^/- /'

Security

As of commit ec49be762ff3 ("feat(dotfiles): automatically sign commits on personal machines", 2022-06-19) and commit 97143b5d7635 ("feat(dotfiles): sign commits everywhere except codespaces", 2022-06-20), I started signing most commits in this and other repos with GPG keys corresponding to my work and personal email addresses.

GitHub will label such commits with a "Verified" badge. In order to see signature information using the git commandline executable, you would run commands such as git show --show-signature and git log --show-signature. Note that in order to be able to actually verify these signatures you need a copy of the corresponding public keys, otherwise Git will show:

gpg: Signature made Mon 11 Jul 2022 11:50:35 CEST
gpg:                using RSA key B0C9C204D656540BDCDA86229F6B84B5B1E9955E
gpg:                issuer "[email protected]"
gpg: Can't check signature: No public key

You can obtain the public keys with the following:

# Either, download directly given the key fingerprint as shown by Git:
gpg --keyserver pgp.mit.edu --recv-key C7C225A18975180C4485A1E070516DBB88E4F779
gpg --keyserver pgp.mit.edu --recv-key B0C9C204D656540BDCDA86229F6B84B5B1E9955E

# Or, chose from a list of possible matches returned by searching for an email address:
gpg --keyserver https://pgp.mit.edu/ --search-keys [email protected]
gpg --keyserver https://pgp.mit.edu/ --search-keys [email protected]

You can also grab the keys from GitHub, if you trust GitHub:

curl https://github.com/wincent.gpg | gpg --import

Once you have those, Git will instead show:

gpg: Signature made Mon 11 Jul 2022 12:28:32 CEST
gpg:                using RSA key B0C9C204D656540BDCDA86229F6B84B5B1E9955E
gpg:                issuer "[email protected]"
gpg: Good signature from "Greg Hurrell <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 2F44 69E0 C1FA 72AA C0A5  60C9 6210 6B56 923F 3481
     Subkey fingerprint: B0C9 C204 D656 540B DCDA  8622 9F6B 84B5 B1E9 955E

What's going on here, cryptographically speaking?

  • GPG keys consist of public and private parts, often referred to as public keys and private keys (together, a "key pair"). As the names suggest, the owner of the key must keep the private part secret, but the public part can be freely shared.
  • Roughly speaking, "signing" something means using the private key to encrypt a hash of the contents of the document that is being signed (in this case, the "document" is a commit).
  • The public key can be used to decrypt the hash, which can then be compared against the contents to confirm that they match. This is what is happening when we see gpg: Good signature above; it means that the public key for Greg Hurrell <[email protected]> verifies that the signature was indeed created with the corresponding private key belonging to that address.
  • Because only the owner has access to the private key, only the owner can make signatures with it; but conversely, because everybody has access to the public key, anybody can verify those signatures.
  • GPG keys have two additional concepts: "subkeys" are keys associated with a primary key; and "usages" describe what role those keys each play (eg. "signing", "encryption").
  • In practice, the primary key is always a "signing" key, and GPG will create one "encryption" subkey by default. Users can add/remove additional subkeys and assign them usages.
  • I create "signing" subkeys for making signatures and I rotate them once per year (I keep my primary key "offline" so that it can't be hacked if my machine is compromised).

So those are the cryptographic primitives. The signature is "Good" in the cryptographic sense, but why the scary "WARNING"? It's because there's a whole other layer on top of this called the "web of trust". A good signature gives us the mathematical certainty that a particular private key was used to produce a given signature, but that tells us nothing about the human world that exists above and around that crypto. That is, the key was used to make the signature, but was it me who used the key? Am I really the handsome Australian man living in Madrid claiming to be Greg Hurrell, or am I in fact part of a clandestine criminal organization operating from a satellite-connected submarine in the Arctic sea?

The web of trust serves to link your human-level trust relationships to the underlying digital entities. By running gpg --edit-key $KEY and hitting trust, you can explicitly record your level of trust in any given key, and you can do things like going to "key signing parties" and such where you can physically meet people, verify their identity by whatever means you deem appropriate, and then sign one another's public keys. The accrued effect of these actions over time is to establish a web of connections where trust is transitively applied: if you trust A and A trusts B, then you in turn can also trust B. Having said all that, how to actually go about building a useful web of trust is beyond the scope of this README, and in all my long years on the internet, I've never once gone to a key signing event or otherwise engaged in activity that would help me integrate my keys into a useful web of trust.

Footnotes

  1. The evenings were spent with vi derivatives, not with Bill Joy. โ†ฉ

  2. This isn't needed on Linux because we can achieve the same via a Kitty configuration. โ†ฉ

  3. See man sudoers. โ†ฉ

ferret's People

Contributors

cpixl avatar fent avatar fuzzbomb avatar infokiller avatar jparise avatar lencioni avatar tdooner avatar vaibhavsagar avatar wincent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ferret's Issues

Allow `c` option for confirmation when using Acks

Mass find and replace is a great first step, but I typically always confirm each of my replacements. Currently if you try to do something like :Acks /foo/bar/c it throws an error. My guess is that you're just passing this to argdo in which case any options should be sent verbatim to argdo. Including if the user chooses to do a find/replace with something other than / as the delimiter.

For example: :Acks -some/thing/with/slashes-another/thing/with/slashes-c

allow umap key as feature

I sometimes accidently do <leader>r and typing, until I realize it was changing quite a lot thing in my buffers
I can map it to another keys but I think an option to unmap key is very helpful

Thanks

Play nicely with 'autochdir'

Firstly, I use ferret all the time - great plugin! However, I also like autochdir (or at least a custom function that doesn't conflict with plugins like dirvish, and this have written a small wrapper around ferret to walk up directories until it finds a .git/ directory and run ferret from there to search project-wide. (See function in my dotfiles)
However, this has stopped working, because it seems that ferret now returns relative file names or something like that so when I open the file from the quickfix window it displays as a new file instead (because the file wasn't found). I'm wondering if there would be a way to make this work again, or if it would be possible to build this feature into ferret itself?

I don't know much vimscript, but would be happy to experiment and submit a pull request if possible (and I get a little support).

Thanks.

Unknown function: job_start

I recently updated NeoVim, and am now getting the following error when calling :Ack:

Error detected while processing function ferret#private#ack[9]..ferret#private#async#search:
line    4:
E117: Unknown function: job_start
E15: Invalid expression: job_start(l:command_and_args, {   'err_cb': 'ferret#private#async#err_cb',   'out_cb': 'ferret#private#async#out_cb',   'close_cb': 'ferret#
private#async#close_cb',   'err_mode': 'raw',   'out_mode': 'raw' })

I just updated to current master and still getting same error. Any clues?

Option to not open first found file automatically

As asked in #13, I'm filling a new issue for this topic.
Maybe it would be better to have on option to not open the file when searching (and maybe it could be the default), as the user may be only looking for the existence of some search term on the project, and don't intend to lose focus from the current code (yeah, it's possible to go back to where it was by pressing <c-o>, but sometimes it's inconvenient to use it everytime when using ferret).

Ack command does not work on Windows 10 for Neovim

I installed the latest version of ferret both on Linux and my Windows machine with Neovim. On Linux, it works as expected. But on Windows, the command Ack simply does not work.

Version info

  • Neovim: version 0.3.4
  • Windows: Windows 10 version 1803
  • rg: 0.10.0

steps to reproduce

  1. Use the following minimal init.vim
" use vim-plug to manage plugins
call plug#begin('~/AppData/Local/nvim/plugged')

" multi file search
Plug 'wincent/ferret'

call plug#end()

""""""""""""""""""""""""""""""ferret settings""""""""""""""""""""""""""""""
" do not use default mapping provided by ferret
let g:FerretMap=0

" use \f to activate :Ack command
nmap \f <Plug>(FerretAck)

" hilight search result by default
let g:FerretHlsearch=1

" prefer to use rg
let g:FerretExecutable='rg,ag'

" custom option for search prog
let g:FerretExecutableArguments = {
  \   'rg': '-S --no-heading --vimgrep'
    \ }

Open neovim with the following command:

" use the above minimal init.vim
nvim -u init.vim
  1. Use :Ack some_string to search string under the current folder. Nothing happens. If I run the search command again, the following error is produced:
Error detected while processing function ferret#private#ack[11]..ferret#private#nvim#search[1]..ferret#private#nvim#cancel:
line    3:
E474: Invalid argument
  1. Open a file and search string inside this file with :Back some_string. It works without any error.

Don't bind to Leader by default

IMO this is only prone to problems, I personally have bound a and s, this plugin would overwrite those.

It provides <Plug> bindings, so it isn't necessary to bind it to anything by default, let the user figure that out.

Bad interaction with syntastic plugin since 7.4.2299 patch applied

Here's the beginning of this issue: Undefined variable: b:syntastic_changedtick with after vim patch 7.4.2299 applied.

I've isolated this with a instance of vim running with only the syntastic and ferret plugins loaded.

I'm guessing this has something to do with how ferret and syntastic try to access/update the quickfix and/or location windows, since the error only occurs when I have syntastic displaying its error list in a location window.

Let me know what kind of info you need to further debug this issue.. not sure if other plugins will be affected.

Translate Perl-compatible patterns to Vim regular expression syntax

:Ack can take fancy Perl-compatible regular expressions.

If you then run :Acks with the same pattern, Vim may not actually find anything, because its patterns are not Perl-compatible, even with the \v flag.

Doing 100% compatible translation would be impossible, as Perl regexen have features that Vim's do not, but we can handle the simple cases at least (eg. \bfoo\b could become <foo>, although we'd need to decide what to do with \bfoo).

replace words usage ?

love your work !

but when i want to replace something i get this (:Acks /foo/bar/ ):
q

Add a binding to reload the quickfix window

First of all, thank you for this cool plugin!

Having a binding to reload the quickfix window would be really nice. Maybe a command like :Rack to repeat the last search could do the trick? Then we could do something like

autocmd FileType qf nnoremap <buffer> r :Rack<cr>

Suggestion: override cfdo with cdo using a gate?

One workflow I got bitten is when I try to edit the quicklist and do an :Acks /foo/bar/ only to find my deleted entries replaced. :Acks is using :cfdo and operates per file. If the deleted entries file path still in the quicklist (there are entries you haven't deleted), it'll replace all occurrences still, which I find it counterintuitive.

While :cdo is generally slower than its :cfdo counterpart, if your workflow includes deleting entries in the quicklist, basically refining it via :Quacks and manual editing. Shouldn't it default to :cdo instead of :cfdo that way it'll respect the quicklist you edited?

Here are a couple of suggestions:

  1. If the user edits the quicklist, :Acks will default to :cdo under the hood.
  2. Or there can be another mapping :Ackr/:Acksc/:Ackc? Which maps with cdo.
  3. ability to override Acks with :cdo.
  4. Or replace :cfdo with :cdo since the results are the same. (If it's using async jobs, I don't think it's going be a problem if it's a tad slower?)

ferret make <cword> not working.

my vimrc:

map <F4> :Ack! -w <cword><cr/>

after i installed ferret, <cword> not working, it can't expand to the word under cursor.

Provide ability to override default options passed to each executable

I have these 2 map in my init.vim:

nmap <leader>a <Plug>(FerretAck)
nmap <leader>z <Plug>(FerretAckWord)

I want the results exclude specific files such as tags. (I guess full command gonna look like :Ack . --ignore-file=is:tags
I have ~/.ackrc that can be perform this way in Ack command line.
But in neovim, it didn't work.

Any suggestions?

Async searching gives "E117: Unknown function: ferret#private#shared#finalize_search"

Trying an async search gives the following error message:

Error detected while processing function ferret#private#async#close_cb:
line   10:
E117: Unknown function: ferret#private#shared#finalize_search

Vim becomes unresponsive for the duration of the "search", though no results show up. It looks like this might have happened in 1c210c9 as the finalize_search function only seems to be called, not defined:

% pwd
/Users/johno/src/dotfiles/vim/bundle/ferret

% rg finalize_search
autoload/ferret/private/async.vim
107:    call ferret#private#shared#finalize_search(l:info.output, l:info.ack)
117:    call ferret#private#shared#finalize_search(l:info.output, l:info.ack)

autoload/ferret/private/vanilla.vim
7:  call ferret#private#shared#finalize_search(l:output, a:ack)

Async execution is confirmed working with other plugins (i.e. https://github.com/skywind3000/asyncrun.vim). Here's the :version output if that's helpful:

:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 30 2017 10:36:10)
MacOS X (unix) version
Included patches: 1-589
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +clipboard       +dialog_con      +file_in_path    +job             -lua             +mouse_sgr       +path_extra      +rightleft       +tag_old_static  +user_commands   +writebackup
+arabic          +cmdline_compl   +diff            +find_in_path    +jumplist        +menu            -mouse_sysmouse  +perl            +ruby            -tag_any_white   +vertsplit       -X11
+autocmd         +cmdline_hist    +digraphs        +float           +keymap          +mksession       +mouse_urxvt     +persistent_undo +scrollbind      -tcl             +virtualedit     -xfontset
-balloon_eval    +cmdline_info    -dnd             +folding         +lambda          +modify_fname    +mouse_xterm     +postscript      +signs           +termguicolors   +visual          -xim
-browse          +comments        -ebcdic          -footer          +langmap         +mouse           +multi_byte      +printer         +smartindent     +terminfo        +visualextra     -xpm
++builtin_terms  +conceal         +emacs_tags      +fork()          +libcall         -mouseshape      +multi_lang      +profile         +startuptime     +termresponse    +viminfo         -xsmp
+byte_offset     +cryptv          +eval            -gettext         +linebreak       +mouse_dec       -mzscheme        -python          +statusline      +textobjects     +vreplace        -xterm_clipboard
+channel         +cscope          +ex_extra        -hangul_input    +lispindent      -mouse_gpm       +netbeans_intg   +python3         -sun_workshop    +timers          +wildignore      -xterm_save
+cindent         +cursorbind      +extra_search    +iconv           +listcmds        -mouse_jsbterm   +num64           +quickfix        +syntax          +title           +wildmenu
-clientserver    +cursorshape     +farsi           +insert_expand   +localmap        +mouse_netterm   +packages        +reltime         +tag_binary      -toolbar         +windows
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib  -L/usr/local/lib -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.0.0 -lobjc

More flexible editing within the quickfix window

My general workflow for large edits has been to use the 'jceb/vim-editqf' plugin to search, edit the quickfix results, and use 'dsummersl/vim-cdo' to make changes. I love the idea of these two activities unified in ferret!

I'd like to be able to use '.' and ':g//del' in quickfix window, but there are probably other commands that would be helpful for editing...I understand opening it up as a standard buffer like vim-editqf might be a little too buggy (then you gotta worry about ppl making un-parsable changes to the buffer), but it would be nice to have a more options when it comes to modifying the quicklist buffer.

Thanks!

ag: unrecognized option '--vimgrep'

Error running search using ag. ag: unrecognized option '--vimgrep' on Ubuntu 14.04 (Ubuntu bash for windows 10), installed using apt-get install silversearcher-ag

:Ack does not find strings after 4.0.0 update

After the 4.0.0 update the :Ack command no longer finds strings that exists in files.

By the way; thanks for a great plugin!

Let me know if you need anymore info.

Environment:
OS: Ubuntu 16.04
Search executable: rg
vim:

NVIM v0.3.1
Build type: RelWithDebInfo
LuaJIT 2.0.4
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=2 -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-xZey2V/neovim-0.3.1/build/config -I/build/neovim-xZey2V/neovim-0.3.1/src -I/usr/include -I/build/neovim-xZey2V/neovim-0.3.1/build/src/nvim/auto -I/build/neovim-xZey2V/neovim-0.3.1/build/include
Compiled by [email protected]

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

ag --vimgrep is not working well

When using ag, the grepprg is set to ag --vimgrep that outputs the same line multiple times if there is more than one match. The problem is that currently all lines are being highlighted in all matches... and it will conflict with #23, where the user won't be able to filter out some of the matches in the same line (:Acks will apply the changes in the entire line). Also the ack tool don't have the option to output the same line multiple times according to each match.

The point is, is --vimgrep really useful? It (currently) won't give a nice highlighting, won't work well with #23 :Acks and can't be reproduced when using ack.

Can get it work

I just want to search word "name" in all files

:Ack \bname\

image

Am I doing something wrong?

:Back throws an error

:Back test
always returns

Error detected while processing function ferret#private#back:
line    1:
E730: using List as a String
E116: Invalid arguments for function call

I have newest neovim and ferret.

Use currently active split instead of bottom right

Currently, when using splits, qickfix always appears on bottom-right split, and when opening files from quickfix it always opens in bottom-right split, and at start opens first file found in current split, so it replaces files in two open splits - current on search, and bottom right on switching files from quickfix.

I think you should do it like ctrl-p does - open at bottom of editor window or at bottom of currently active split, and open files in currently active split instead of bottom-right, and do not open first found file automatically (or at least make it configurable).

Present errors to user in helpful way

(Forking this from #1).

We should catch some common classes of errors and show the user a helpful warning in the quickfix listing.

  • Trying to search in a non-existent directory (ie. :Ack foo bar)
  • Trying to use quotes (ie. :Ack 'foo bar' or :Ack "foo bar")

Both of those are going to produce errors like:

|| ERR: Error stat()ing: bar'
|| ERR: Error opening directory bar': No such file or directory

Another mistake would be the non-space case (:Ack 'foo'). That won't run into a stat error, but it won't find "foo" either (it's looking for single quote followed by "foo" followed by single quote).

The problem with catching stat errors is they'll likely be slightly different from platform to platform, so we need to find the right way to detect them without risking false positives (alas, we don't necessarily get access to the exit status of the underlying process).

As for catching errors for the 'foo' case, we can probably just consider it an error whenever a search is wrapped in quotes and doesn't return any results.

Add `:Back` and `:Black` commands

Like :Ack and :Lack respectively, but scoped to the currently open buffers.

If the user specifies a path, could use that to filter the results, or maybe just keep things simple and disallow path arguments.

Ferret's autocommands clash with other plugins quickfix/loclist display settings

Hey @wincent, I've got an issue with Ferret clashing with Neomake.

After some digging I've traced it to this autocommand:

autocmd QuickFixCmdPost l* nested lwindow

Without ferret, when I run :Neomake on saving a file, neomake fills the loclist with linter/build output and then looks at some configuration to determine whether to call lwindow and with what argument. This allows users to disable the location list popping up, or to change its height.

Problem being, that ferret autocommand hook for QuickFixCmdPost is calling lwindow unconditionally, so the Neomake configuration settings have no effect.

Happy to attempt a PR for this, but wanted to ping you first to ask:

  • Does it make sense to just run lwindow / cwindow in ferret#private#complete instead?
  • Can the autocommand subscribers be scoped to some more-ferret-specific event names?

Thanks! And thanks for ferret, it's been really useful to me!

Search gives a list of seemingly correct search results in an error message

If I run :Ack main_view, I get a response that looks like this:

app.py:42:42     from {{ project_name }}.views import main_view
[a bunch more lines with valid search results]
Search for `main_view` failed: press ENTER to continue

I never get a quickfix opened or anything interactable. Not really sure where to start in debugging this.

I have ag version 0.31.0 on an Ubuntu 16.04 machine.

Add back fallback support for `grep`

This was removed in 1.4 because it didn't work at all.

But it would be nice to add it back.

I think the right way to do this might be by adding the ability to customize the executable and args used (beyond the current hard-coded list). My main concern is that grep may vary a fair bit from platform to platform (BSD grep vs GNU grep etc), so getting a default config that works everywhere might be fiddly and brittle.

First result might be prefixed with "^[[?25h^[[0G^[[?25h^[[0G" in "older" Vim

I'm not entirely sure when this started happening, but lately when I use :Ack, the first result was prefixed with ^[[?25h^[[0G^[[?25h^[[0G in the quickfix window. Obviously this prevents me from being able to press enter to open that result.

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 29 2016 08:31:57)
MacOS X (unix) version
Included patches: 1-1795
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +termtruecolor
+channel         -gettext         -mzscheme        +textobjects
+cindent         -hangul_input    +netbeans_intg   +timers
-clientserver    +iconv           +packages        +title
+clipboard       +insert_expand   +path_extra      -toolbar
+cmdline_compl   +job             +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -DMACOS_X_UNIX  -Os -w -pipe -march=native
 -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L. -L/Users/joe_lencioni/.rbenv/versions/2.3.0/lib  -fstack-protector -L/usr/local/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/usr/local/Cellar/python/2.7.11/Frameworks -frame
work Python   -lruby-static -framework CoreFoundation -lobjc -L/Users/joe_lencioni/.rbenv/versions/2.3.0/lib

After updating Vim to include patches 1-1941, this problem seems to go away

Small error in the documentation

In the mapping section the documentation says:

Circumstances where mappings do not get set up ~
....
- The mapping has been suppressed by setting |g:FerretMap| to 1 in your |.vimrc|.

But then the section explaining g:FerretMap seems to say the contrary to me. (0 is the correct value to disable the mappings)

Controls whether to set up the Ferret mappings, such as |<Plug>(FerretAck)|
(see |ferret-mappings| for a full list). To prevent any mapping from being
configured, set to 0:
>    let g:FerretMap=0

Enhancement: option to disable syntastic when running :Acks

I use Syntastic, but don't want it to run when doing multi-file find/replace via :Acks because it adds no value but it slows down the operation considerably. I have currently added the following mapping in a .vim/after/plugin/ferret.vim file:

" Wrapper around ferret's `:Acks` to disable and re-enable syntastic for speed.
function! Acks(command)
  " Syntastic makes saving slow, and since we aren't looking at the files to see
  " the warnings, we want to disable it when running through the files.
  SyntasticToggleMode

  call ferret#private#acks(a:command)

  " Re-enable syntastic.
  SyntasticToggleMode
endfunction

command! -nargs=1 Acks call Acks(<q-args>)

But others might want this functionality and might benefit from having an option baked into ferret itself. I'm also a little uncomfortable calling into something labeled "private". However, this is simple enough that it probably doesn't add a whole lot of value to ferret, and I can see the argument for not wanting to support every other plugin. However, I believe that Syntastic is popular enough that it might be worth baking something like this in to an option.

Would you be open to a pull request that adds this feature?

Multi-word :Ack gives me errors

I'm trying to switch from my Ack configuration I stole from your dotfiles ages ago to ferret, and I'm running into issues when trying to :Ack for multi-word strings. I've tried :Ack "foo bar", :Ack 'foo bar', :Ack /foo bar/, :Ack \foo bar\, and :Ack foo bar and I always get the same type of error (these errors are for the version with double quotes):

ERR: Error stat()ing: bar"
ERR: Error opening directory bar": No such file or directory

I tried both with and without vim-dispatch and had similar results.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.