I have several abbreviations for ack:
cnoreabbrev Ack Ack!
cnoreabbrev ack Ack!
which rewrites ack to Ack! in vim's command line/mode.
Now I'd like to use file name without extension to ignore it from searches using
:echo expand('%:r')
I imagined that I'd do it similarly to bash expansion using `
cnoreabbrev acki Ack! --ignore `expand('%:r')`
but this doesn't work.
How can I achieve this? I specifically want the abbreviation not a function (but it might be there indirectly) to have an uninterrupted flow where I write acki and then immediately search term
If you want to use
expand ()you'll need to play withc_CTRL-R=. fortunatelly here you won't need something that complex.Indeed,
%is enough to obtain the filename. To keep only its main part you can then use%<from plain old vi.