Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 6 characters in body
Source Link

I often need to make a case-insensitive search of the current word (under cursor) in a dictionary file which has a simple txt format, one entry per line. One possible solution is to record a macro in a register which will make the grep for me and display the matches in the command-line mode, such as

:!grep -i word ~/path/to/dictfile.txt

where the current word can be substituted by means of ^R^W. This works, but it has some disadvantages.

-The list of matches disappears once I hit Enter. Keeping the results in a window would be useful. The contents of the window should update when I make a new search.

-The list of matches provides no highlighting of the search pattern, which would increase the readability.

  • The list of matches disappears once I hit Enter. Keeping the results in a window would be useful. The contents of the window should update when I make a new search.

  • The list of matches provides no highlighting of the search pattern, which would increase the readability.

I have tried to make a script which would output the matches to another file for viewing. However, I was not able to ensure in the script that exactly one window with the matches stays open and refreshes with a renewed grepping.

Another solution might come via the :vimgrep:vimgrep command and displaying the quickfix list via the :cwindow:cwindow command. But there, I get lots of unwanted information (~/path/to/dictfile.txt, |linenumber col colnumber| and no highlighting.

I often need to make a case-insensitive search of the current word (under cursor) in a dictionary file which has a simple txt format, one entry per line. One possible solution is to record a macro in a register which will make the grep for me and display the matches in the command-line mode, such as

:!grep -i word ~/path/to/dictfile.txt

where the current word can be substituted by means of ^R^W. This works, but it has some disadvantages.

-The list of matches disappears once I hit Enter. Keeping the results in a window would be useful. The contents of the window should update when I make a new search.

-The list of matches provides no highlighting of the search pattern, which would increase the readability.

I have tried to make a script which would output the matches to another file for viewing. However, I was not able to ensure in the script that exactly one window with the matches stays open and refreshes with a renewed grepping.

Another solution might come via the :vimgrep command and displaying the quickfix list via the :cwindow command. But there, I get lots of unwanted information (~/path/to/dictfile.txt, |linenumber col colnumber| and no highlighting.

I often need to make a case-insensitive search of the current word (under cursor) in a dictionary file which has a simple txt format, one entry per line. One possible solution is to record a macro in a register which will make the grep for me and display the matches in the command-line mode, such as

:!grep -i word ~/path/to/dictfile.txt

where the current word can be substituted by means of ^R^W. This works, but it has some disadvantages.

  • The list of matches disappears once I hit Enter. Keeping the results in a window would be useful. The contents of the window should update when I make a new search.

  • The list of matches provides no highlighting of the search pattern, which would increase the readability.

I have tried to make a script which would output the matches to another file for viewing. However, I was not able to ensure in the script that exactly one window with the matches stays open and refreshes with a renewed grepping.

Another solution might come via the :vimgrep command and displaying the quickfix list via the :cwindow command. But there, I get lots of unwanted information (~/path/to/dictfile.txt, |linenumber col colnumber| and no highlighting.

Source Link

grep in my specific dictionary

I often need to make a case-insensitive search of the current word (under cursor) in a dictionary file which has a simple txt format, one entry per line. One possible solution is to record a macro in a register which will make the grep for me and display the matches in the command-line mode, such as

:!grep -i word ~/path/to/dictfile.txt

where the current word can be substituted by means of ^R^W. This works, but it has some disadvantages.

-The list of matches disappears once I hit Enter. Keeping the results in a window would be useful. The contents of the window should update when I make a new search.

-The list of matches provides no highlighting of the search pattern, which would increase the readability.

I have tried to make a script which would output the matches to another file for viewing. However, I was not able to ensure in the script that exactly one window with the matches stays open and refreshes with a renewed grepping.

Another solution might come via the :vimgrep command and displaying the quickfix list via the :cwindow command. But there, I get lots of unwanted information (~/path/to/dictfile.txt, |linenumber col colnumber| and no highlighting.