Coder Social home page Coder Social logo

Mappings about ag.vim HOT 9 OPEN

rking avatar rking commented on September 28, 2024
Mappings

from ag.vim.

Comments (9)

Konfekt avatar Konfekt commented on September 28, 2024

How about your proper mappings in qf.vim by adding (as a starter)

let s:qf_mappings = {
      \ "o": "<CR>",
      \ "O": "<CR><c-w>p",
      \ "q": "<C-W>c" }

for key_map in items(s:qf_mappings)
  execute printf("nnoremap <buffer><nowait><silent> %s %s", get(key_map, 0), get(key_map, 1))
endfor

?

This way, they are available even if the qflist was populated by other means than ag.vim.

NB: O is Ag's go

from ag.vim.

amerlyq avatar amerlyq commented on September 28, 2024

However this snippet have not solved problem of l:matches_window_prefix, which determines kind of window we are working in, but you gave me one more viewpoint for idea. So, using your link notion at thinca/vim-qfreplace#5 , resulting solution seems like:

" file: ~/.vim/after/ftplugin/qf.vim

" Thanks to: https://github.com/romainl/dotvim/blob/master/bundle/qf/after/ftplugin/qf.vim
" are we in a location list or a quickfix list?
let b:isLoc = len(getloclist(0)) > 0 ? 1 : 0
let b:wPref = b:isLoc ? 'l' : 'c'

"" Rule of Thumb: reuse editing mappings, and don't touch navigation
" q/<Space> - close / jump,
" o/O - preview/jump of and stay,        I - jump into and close,
" x/X - exchange to tab foregr/backgr,   S/H - split vert/horz,
let s:qf_mappings = {
      \ 'q' : ':#close<CR>',
      \ 'o' : '<CR><C-w>p',
      \ 'O' : '<CR>',
      \ 'I' : '<CR><C-w><C-w>:#close<CR>',
      \ 'S' : '<C-w><CR><C-w>L<C-w>p<C-w>J<C-w>p',
      \ 'H' : '<C-W><CR><C-w>K<C-w>b',
      \ 'x' : '<C-w><CR><C-w>T',
      \ 'X' : '<C-w><CR><C-w>TgT<C-W><C-W>',
      \ '<Space>' : '<CR>',
\ }

for key_map in items(s:qf_mappings)
  exec printf("nnoremap <buffer><nowait><silent> %s %s", get(key_map, 0)
                    \ , substitute(get(key_map, 1), '#', b:wPref, 'g'))
endfor

Issue can be closed, due to changed solution orientation.

from ag.vim.

Konfekt avatar Konfekt commented on September 28, 2024

Cool,

Note that the solution further down in the qfreplace thread is more stable than that by getloclist().

from ag.vim.

amerlyq avatar amerlyq commented on September 28, 2024

When albfan/ag.vim #21 enabling user customization will be implemented and merged into trunk, this issue could be finally closed.

from ag.vim.

wsdjeg avatar wsdjeg commented on September 28, 2024

@amerlyq I'm using rking/ag.vm .how about you fork, does it contains replace func?
just like easygrep

from ag.vim.

amerlyq avatar amerlyq commented on September 28, 2024

Don't know what about vim-easygrep, because its code for me seemed rather obscure and overbloated to try it even once.
I use combo of ag.vim with quickfix-reflector.vim when need to do some multi-file replacements. For me editing directly in qf seems much easier.

from ag.vim.

wsdjeg avatar wsdjeg commented on September 28, 2024

now the most use tool for me is Unite , here is the link https://github.com/Shougo/unite.vim

from ag.vim.

wsdjeg avatar wsdjeg commented on September 28, 2024

it is a source tools ,you can create yourself source and ,shown by Unite

from ag.vim.

losingkeys avatar losingkeys commented on September 28, 2024

The map of mappings idea would work, but I wonder if there's a way to make a new filetype yet retain all the quickfix/location list features. If we could do that, then we could just set all the mappings in an autogroup and let people disable that or map over the mappings themselves. That might be more natural, though I've never heard of being able to alias a file type.

from ag.vim.

Related Issues (20)

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.