VIM 7 and cscope: using "cscope find f" inside the keyboard display to switch between files

I usually go between files on my database with cscope index using

:cscope find f <filename> 

I'm trying to determine a key combination so that I don't have to type ": cscope find f" every time. By clicking this shortcut, you will receive an input prompt into which I will enter part of the file name in the cscope database. If there are several files, it will display a list of files from which I can select the file to which I want to go. I still have so many, but since I don’t own VIM scripts at all, I can’t complete this. (which I still encoded from another question, thanks to Eelvex ).

Can someone fix the below script for me? I get numerous errors while I try to use this shortcut

 function! GetPat() call inputsave() let filename = input("Enter filename: ") call inputrestore() return filename endfunction map ` :cscope find f '.GetPat().'<CR> 
+2
source share
1 answer

The display will not wait for input to enter and continue. In addition, the display is incorrect, remember that the mappings work as if you typed the text, you can leave with something like this (not tested):

 noremap <expr> ` ':cscope find f '.GetPat()."\<CR>" 

But why not just:

 noremap ` :cscope find f<space> 

This will leave you after the last space is ready to enter your template and just press enter .

+2
source

Source: https://habr.com/ru/post/1344768/


All Articles