Giter Club home page Giter Club logo

vim-ags's Introduction

_____     ____  ______
\__  \   / ___\/  ___/
 / __ \_/ /_/  >___ \ 
(____  /\___  /____  >
     \//_____/     \/ 

Silver searcher (AG) plugin for Vim

A Vim plugin for the silver searcher or ripgrep that focuses on
clear display and easy navigation of the search results

Installation

Install via pathogen, vundle, plug or copy to the Vim directory
The ag or rg executable must be installed as well.

Usage

See the docs or press u (for usage) while in the search results window.

Using ripgrep instead of ag

Despite the name vim-ags works with ripgrep as well if configured as below:

let g:ags_agexe = 'rg'

let g:ags_agargs = {
  \ '--column'         : ['', ''],
  \ '--line-number'    : ['', ''],
  \ '--context'        : ['g:ags_agcontext', '-C'],
  \ '--max-count'      : ['g:ags_agmaxcount', ''],
  \ '--heading'        : ['',''],
  \ '--smart-case'     : ['','-S'],
  \ '--color'          : ['always',''],
  \ '--colors'         : [['match:fg:green', 'match:bg:black', 'match:style:nobold', 'path:fg:red', 'path:style:bold', 'line:fg:black', 'line:style:bold'] ,''],
  \ }

Sample Shortcut Mappings

" Search for the word under cursor
nnoremap <Leader>s :Ags<Space><C-R>=expand('<cword>')<CR><CR>
" Search for the visually selected text
vnoremap <Leader>s y:Ags<Space><C-R>='"' . escape(@", '"*?()[]{}.') . '"'<CR><CR>
" Run Ags
nnoremap <Leader>a :Ags<Space>
" Quit Ags
nnoremap <Leader><Leader>a :AgsQuit<CR>

Notes

Works with ag version >= 0.29.1 or ripgrep >= 11.0.2

Screenshots

Here are a couple of screenshots of the search results window

View mode (with lightline integration)

Edit mode

Similar Plugins

ctrlsf

vim-ags's People

Contributors

blueyed avatar dhrubesh avatar gabesoft avatar ix5 avatar komissarex avatar opatut 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

vim-ags's Issues

Problems getting search to follow symlinks

I'm searching in a folder full of symlinks and getting no results for patterns I know are present. I've tried enabling symlink following in a couple of ways. In my config file, I added this: let g:ags_agargs['--follow'] = ['',''], but I get an Undefined variable error. I've also tried adding the option in the command (:Ags --follow pattern, but that also fails to produce results (No matches for '--follow pattern').

I can run the search for the same pattern specifying the location of the source file and get results, so it definitely seems the symlink is not being followed.

Search results on new MacBook includes color encodings

I just upgraded to the new M1 MacBook and I'm getting what I think are the color encodings in the search results screen.

image

Not really sure if it's a problem with vim-ags or something else. Wondering if anyone else has seen this or if anyone has any thoughts to fix it. Thanks!

I'm using
MacOS 11.2.2
Vim 8.2.1972
Tmux 3.1c

Can't open files from search results

When I perform a search using the :Ags command, the search pane opens with the results displayed, however, I can't open any of the files in the searches results, either by pressing Enter, or by typing 'oa' or any of the other related commands.

when I press Enter, the status bar just reads; ": AgsOpenFileReuse" but nothing happens.

I'm using:

  • Vim version 7.4.965
  • Windows 7 SE 1 (64-bit)
  • AG version 1.0.3

Optionally populate location/quickfix list

While there is an edit mode already (awesome!), it might still be useful to have the results in the location or quickfix list.

It was mentioned in #7 (comment) already:

So it would be really cool if there was some way of populating the location buffer or quickfix buffer with the results of ags.

I could imagine having a separate command for that and/or an action from the result window to trigger it.

file name encoding problem

When the encoding is inconsistent, the plug-in will not work properly.

test file:

新建文本文档.js

123哈哈

test command:

Arg --js 1

vimrc:

encoding = utf-8
fileencoding = cp936

results:

No target or display is not normal.

[Neovim] add async support?

Would you like to add async support for Neovim and vim-dispatch? One example could be found from here

With the async support, it could also improve performance, because user doesn't need to wait for all results to be fetched.

Great plugin but too slow.

Hey, this is a really cool feature, reduces the clutter in search results a lot. But it is way too slow as compared to Ag.vim . I haven't looked at the code, but I assume it's doing some post processing in vimscript to the results, and trying to create a buffer with locations, would be cool if you could somehow make it faster (maybe push the processing to ag and vim location buffer?)

Unrecognized option --filename

Hi,

I've just installed the plugin and after triggering a search in Vim (with :Ags something) the ag executable just complained about the --filename option. Here is an screenshot of the output (where you can also see the version of ag I'm running):

1__tmux

Edit mode

When pressing E I can edit all the files without going through the process of opening every single file, make the change and close it. How can I save all the files when I'm in E mode?

When I quit the window, I get:

E37: No write since last change
E162: No write since last change for buffer "search-results.agse"

Cheers,
Matthias

Colors not working.

After searching, my result looks like this:

[1;31mdrivers/mmc/core/debugfs.c[0m[K
[1;30m 200 [0m[K-
[1;30m 201 [0m[K-   mmc_claim_host(host);
[1;30m 202 [0m[K-   mmc_set_clock(host, (unsigned int) val);
[1;30m 203 [0m[K:2: [32;40mmmc_release_host[0m[K(host);
[1;30m 204 [0m[K-
[1;30m 205 [0m[K-   return 0;
[1;30m 206 [0m[K-}

There are no colors and escape characters are seen so obviously something went wrong. Tested on both vim and gvim 7.4 on Linux.

Add folding markers

It would be awesome to have fold markers/regions so I could e.g. close all files (show only the path, fold away the search matches inside) and then scroll through the files list and expand those I'm interested in.

Use system PATH by default to look for ag executable

Most people install ag into a directory which is part of their PATH variable. To have a simpler installation without configuring anything, vim-ags should look for the executable in the PATH first and not under a hard coded path.

See for example, like rking/ag plugin does it.

reuse last window behavior

I have a nerdtree window open a lot of the times like...

2015-10-23 at 7 18 am

My cursor is in the file contents window (right most) and when I do a search and press enter in the search results it always opens in the nerdtree window like...

2015-10-23 at 7 21 am

Is this expected behavior? Some other issue I was reading gave me the impression that it would use the last window you were using.

Regression for searches with spaces?

Hi,

I just updated from 3b95ee7 to latest master for the neovim async support (very nice by the way!) One thing I noticed is that something in between seems to have broken searches with spaces in them.

For example, :Ags "my string" would return results before, now I get no results even though running ag "my string" in the CLI gives the same results as before. Searches that don't have spaces still seem to work fine.

I'm using a recent-ish neovim if that helps.

Searching from git root

Is it possible to search from the root folder in a directory which has a .git folder? Similar to how CtrlP works.

[Question] Mapping :Ags

Please excuse me for asking a basic question - I am relatively new to VIM.

How can I map ":Ags" to something easy to type command? Maybe just "//", so a search could be performed using "//SearchText"

Open results without creating a new window?

Hi,
Is there a way to open a file from the search results without creating a new window/split? I want the results file to take up the window space I was using before calling :Ags, but it seems to always open the results in a split between search-results.agsv and the old window.

From the docs, it looks like <cr> or ou would do what I want, but it always opens a new window above the search results. Not sure if this is a weird interaction with my .vimrc or something.

Great plugin by the way!

Can't cancel long searches

I'm using Neovim. When I accidentally search from my home directory, or from anywhere that would take way too long, Ags freezes the whole UI so I have to kill the terminal to get out of vim. It does display some messages and the cursor jumps around in the search results window, but when I try pressing q or Ctrl-C nothing happens.

Feature request: Open a result and dismiss search-results.agsv in one step

Sometimes you're only looking for a single search result, and then you have no further need for the results window. Ideally in this case you could open the result and dismiss the results window with a single keybinding (essentially, UO and q combined into one step). Thoughts on adding this as a built-in action?

Error when calling HTTPClientDoRequest

Every time I make a request I get an error. I had to install Python's request library, but this error exists after the install.

HTTP_Client_Response" [New File]
Error detected while processing function 65_DoHTTPRequest:
line 11:
Traceback (most recent call last):
File "", line 1, in
File "/Users/dsteplight/.vim/bundle/vim-http-client/plugin/http_client.py", line 124, in do_request_from_buffer
open_scratch_buffer(response, vim_ft)
File "/Users/dsteplight/.vim/bundle/vim-http-client/plugin/http_client.py", line 113, in open_scratch_buffer
vim.current.buffer[:] = contents
TypeError: bad argument type for built-in operation

Weird highlighting characters

Thanks for a useful plugin!

Anyway I have some highlighting issues in Macvim. I tried to disable colors using let g:ags_agexe = 'ag --nocolor' but the issue is still there on some lines.

Any ideas?

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.