key mapping
Trid-collab opened this issue · 7 comments
I am new to this. I am using the latest neovim nightly.
I was trying to disable the keymaps as it was conflicting with the ones I have doing - it didn't seem to work
let g:FerretMap = 0
Also I was trying keyboard mappings for Back, Black, Qack. Lacks using (FerretBack),(FerretBlack),(FerretQuack) and so on. The only ones which I could get to rework were the Ack, AckWord, and the Lack
How can I do the current buffer only search and replace not the entire directory structure all the files in the buffer
Can we do git grep and replace as well
How can I do the current buffer only search and replace not the entire directory structure all the files in the buffer
Not with this tool. The entire purpose of this tool is multi-file search. For within-buffer search, use Vim's built-in tools, or a plug-in like:
- Loupe: Enhances Vim's built-in search.
- Scalpel: Streamlined find-and-replace within a buffer.
- ... probably lots of others out there...
it didn't seem to work
let g:FerretMap = 0
This will work if you put it in your ~/.vimrc
/~/.vim/vimrc
or ~/.config/nvim/init.vim
before Ferret loads. You can see the check being performed here.
Also I was trying keyboard mappings for Back, Black, Qack. Lacks using (FerretBack),(FerretBlack),(FerretQuack) and so on. The only ones which I could get to rework were the Ack, AckWord, and the Lack
It should be easy to follow the pattern seen here. Once again, make sure you do it before Ferret loads.
Thank you for your inputs.
I included the following lines in my init.vim for neovim nightly
But I found the mapping for only FerretAck, FerretAckWord, FerretLack and FerretAcks working. The rest don't seem to be working. Have I missed anything or done anything wrong in the settings.
nmap <leader>aa <Plug>(FerretAck)
nmap <leader>aw <Plug>(FerretAckWord)
nmap <leader>aq <Plug>(FerretQuack)
nmap <leader>al <Plug>(FerretLack)
nmap <leader>ab <Plug>(FerretBack)
nmap <leader>as <Plug>(FerretAcks)
(I edited your comment because the Markdown renderer ate the <Plug>
tags.) Don't see anything wrong with those, so I just pasted them in to a Vim instance and tried them, and I can actually see the same thing you're seeing: the <leader>aq
and <leader>ab
mappings don't seem to work.
And looking at the source, I see it's because those targets don't exist... presumably because nobody ever asked for them.
It would be very easy to add them, and I'll go ahead and do that now. I think all that's going to be needed is:
nnoremap <Plug>(FerretQuack) :Quack<space>
nnoremap <Plug>(FerretBack) :Back<space>
and then your mappings will work:
nmap <leader>aq <Plug>(FerretQuack)
nmap <leader>ab <Plug>(FerretBack)
I may as well add this at the same time, as I think it's also not currently covered:
nnoremap <Plug>(FerretBlack) :Black<space>
Thank you very much. I just downloaded the latest update. it works perfectly. It makes my requirement complete. I was trying different options before , this is most simple and convenient.
PS : I follow your Youtube channel and a fan of the it and have learnt a lot from it
Thank you again for entertaining a request from a newbie like me
I small query though I found that nnoremap option does not work when I do the mappings for any of the Ferret options only the nmap options work.
I found the same issue with Scalpel as well which also I have started using and find it very useful.
My other nnoremaps are working fine
I think this is expected.
nmap
: Short for[n]ormal mode "map"
— Maps "LHS" (Left-Hand Side) to "RHS" (Right-Hand Side). Whatever "RHS" is may end up matching other mappings that in turn map it onto yet-another "RHS', and so on, recursively.nnoremap
: Short for[n]ormal mode "no remap"
— Again, maps "LHS" to "RHS", but the "no remap" means to stop there and not look for any further mappings.
Therefore, to map to something like <Plug>(Anything)
, you have to use nmap
and not nnoremap
. If you use nnoremap
, you're telling Vim not to expand <Plug>(Anything)
to find out what that maps to.
Makes sense?
Thank you very much for the explanation. This clarifies many other I had.