vimgrep

How to recursively grep the pattern inside the directory?

ε祈祈猫儿з 提交于 2021-01-03 08:45:41
问题 I would like to grep all string patterns which are start with the: student_ , then any numbers of symbols(letters and digits) and end with the .tcl 回答1: grep "student_[[:alnum:]]*\.tcl" * 回答2: If you're using vim 7, it comes with a build in grep function that puts the result in a quicklist-window. try :vimgrep /^student_/ **/*.tcl ** makes the search recursivelly To search in current directory only, use: :vimgrep /^student_/ *.tcl read more @ vim.wikia.com 来源: https://stackoverflow.com

How to exclude file patterns in vimgrep?

試著忘記壹切 提交于 2019-12-09 07:43:12
问题 In vim, I do search with vimgrep frequently. I have mapping like below: map <leader>s :execute "noautocmd vimgrep /\\<" . expand("<cword>") . "\\>/gj **/*.*" <Bar> cw<CR> 5 The problem is that there are some temporary subfolders (like obj, objd) that I don't want to search for. How can I exclude subfolders matching given patterns. For example, subfolders with prefix "objd" should not be included in searching. 回答1: As of Vim 7.3.570, you can use wildignore to exclude patterns with vimgrep. For

how to open multiple files in vim after vimgrep

老子叫甜甜 提交于 2019-12-08 00:44:53
问题 I'm using gvim. Using vimgrep on current directory to find text across *.sql files. As it searches files, it just shows me file name at a time and in the end opens one file up. Is it possible to open all files as tabs? Basically I want to open all files because I want to replace the 'vimgrepped' pattern with a some other text. 回答1: To automate actions on the QuickFix list locations, I have written a command similar to :bufdo or :windo that executes a command for each item. command! -nargs=+

how to open multiple files in vim after vimgrep

只谈情不闲聊 提交于 2019-12-06 05:00:27
I'm using gvim. Using vimgrep on current directory to find text across *.sql files. As it searches files, it just shows me file name at a time and in the end opens one file up. Is it possible to open all files as tabs? Basically I want to open all files because I want to replace the 'vimgrepped' pattern with a some other text. To automate actions on the QuickFix list locations, I have written a command similar to :bufdo or :windo that executes a command for each item. command! -nargs=+ Qfixdo call QuickFixDo(<q-args>) function! QuickFixDo(cmd) let bufnam = {} for q in getqflist() let bufnam[q

ag Silver Searcher: what are the rules for patterns?

假装没事ソ 提交于 2019-12-04 15:37:29
问题 I'm using ag in Vim with good results for string/file search. However, there seems to be not much documentation how patterns are constructed for ag. I'm trying to use ag instead of vimgrep in an example from the Practical Vim book. I want to find every occurrence of "Pragmatic Vim" in all files in a directory recursively, and substitute this string with "Practical Vim". There is also "Pragmatic Bookshelf" in some files, and that string must remain. the book suggests this approach: /Pragmatic

ag Silver Searcher: what are the rules for patterns?

自闭症网瘾萝莉.ら 提交于 2019-12-03 09:43:52
I'm using ag in Vim with good results for string/file search. However, there seems to be not much documentation how patterns are constructed for ag. I'm trying to use ag instead of vimgrep in an example from the Practical Vim book. I want to find every occurrence of "Pragmatic Vim" in all files in a directory recursively, and substitute this string with "Practical Vim". There is also "Pragmatic Bookshelf" in some files, and that string must remain. the book suggests this approach: /Pragmatic\ze Vim :vimgrep /<C-r>// **/*.txt And after that step, populate quickfix list with :Qargs plugin

How to exclude file patterns in vimgrep?

自作多情 提交于 2019-12-03 09:36:55
In vim, I do search with vimgrep frequently. I have mapping like below: map <leader>s :execute "noautocmd vimgrep /\\<" . expand("<cword>") . "\\>/gj **/*.*" <Bar> cw<CR> 5 The problem is that there are some temporary subfolders (like obj, objd) that I don't want to search for. How can I exclude subfolders matching given patterns. For example, subfolders with prefix "objd" should not be included in searching. As of Vim 7.3.570, you can use wildignore to exclude patterns with vimgrep. For example, to ignore the objd subfolder: :set wildignore+=objd/** Additional exclusions can be added by