Closed petobens closed 10 years ago
I ended up using "ag". Thanks anyway.
ag is faster
Yes, much faster. There is however one problem: I'm using windows and the unite buffer displays "^M" (carriage returns) after running: nnoremap <silent><leader>ut :Unite grep:%::TODO\:\|FIXME\:\|NOTE\:<CR>
. I know I can delete those characters with a mapping that performs the following substitution: %s/\r//g
. I was wondering if there was some way of telling Unite not to show those characters? I tried setting set ffs = unix,dos
but the "^M" still appears at end of lines.
Another question. With "ag", can I use the async
flag when searching for files in Windows?. If I set nnoremap <silent><Leader>uf :Unite -silent -auto-resize file_rec/async<CR>
I get an empty buffer. Am I doing something wrong?
way of telling Unite not to show those characters? I tried setting set ffs = unix,dos but the "^M" still appears at end of lines.
Another question. With "ag", can I use the async flag when searching for files in Windows?
Sorry, I have not "ag" binary in Windows. So I cannot fix it.
The following command :Unite vimgrep:%:\CTODO:|FIXME:|NOTE: only does "vimgrep /CTODO/j %" . How should I write my vimgprep command in Unite in order to matchcase and search for todos, fixmes and notes?
You must escape "\" and ":".
:Unite vimgrep:%:\\CTODO\:\\|FIXME\:\\|NOTE\:
Sorry, I have not "ag" binary in Windows. So I cannot fix it.
Maybe trimming ( like trimRight in js ) the lines could fix it.
Okay, until there is a fix I will be using:
nnoremap <silent> <leader>ut :Unite -toggle -auto-resize -auto-highlight
\ vimgrep:%:\\CTODO\:\\<bar>FIXME\:\\<bar>NOTE\:<CR>
Okay, until there is a fix I will be using:
To build ag in Windows is too difficult. So I can't fix it.
Maybe trimming ( like trimRight in js ) the lines could fix it.
No. Trimming is implemented. But it is not works. So I must try ag binary in Windows. But I cannot build it.
Thanks. I will try it.
I fixed the problem. Please update vimproc and unite.vim.
And you must use following settings to use ag.
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts =
\ '--line-numbers --nocolor --nogroup --hidden --ignore ' .
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
let g:unite_source_grep_recursive_opt = ''
By default, ag ignores VCS folders
2013/7/30 Shougo notifications@github.com
I fixed the problem. Please update vimproc and unite.vim.
And you must use following settings to use ag.
let g:unite_source_grep_command = 'ag' let g:unite_source_grep_default_opts = \ '--line-numbers --nocolor --nogroup --hidden --ignore ' . \ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr''' let g:unite_source_grep_recursive_opt = ''
— Reply to this email directly or view it on GitHubhttps://github.com/Shougo/unite.vim/issues/315#issuecomment-21784948 .
By default, ag ignores VCS folders
Yes. But it ignores other hidden files.
Thanks, after updating and setting set fileformat=unix
in my vimrc file the carriage returns are not shown anymore and I can use file_rec/async
source in Windows! There is however one problem, when I grep my vimrc to find todos with the map:
nnoremap <silent><leader>ug :Unite -silent -auto-resize -auto-highlight
\ grep:%::TODO\:\|FIXME\:\|NOTE\:<CR>
I get a warning saying
unite:jump_list: Invalid action__line format.
Can I ignore it or is it a problem?
I think the problem is due to the auto-highlight
flag? I can't use that flag while grepping?
I get a warning saying unite:jump_list: Invalid action__line format. Can I ignore it or is it a problem?
No. I think your unite-grep settings are wrong.
I think there is still a problem with the carriage returns. If I grep the same file for instance to findo todos with
nnoremap <silent><leader>ug :Unite -silent -auto-resize grep:%::TODO\:\|FIXME\:\|NOTE\:<CR>
then no carriage returns appear but if just call :Unite grep
and grep a different directory than that of the current file the ^M
characters still appears.
You should create minimal .vimrc and sample text file without other plugins. If you show it, I will check it.
Minimal vimrc like this?:
set nocompatible
set runtimepath+=path/to/plugin
Yes.
If I run gvim with this vimrc:
set nocompatible
let mapleader = ","
set runtimepath+=$HOME\vimfiles\bundle\unite
set runtimepath+=$HOME\vimfiles\bundle\vimproc
set encoding=utf-8
set fileformat=unix
set fileformats=unix,dos
if executable('ag')
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts =
\ '--smart-case --line-numbers --nocolor --nogroup'
let g:unite_source_grep_recursive_opt = ''
endif
nnoremap <silent> <Leader>ag :Unite -silent -auto-resize
\ -buffer-name=ag grep<CR>
I can still reproduce the problem as you can see in the image below.
OK. I will check it.
I fixed the problem. Please update vimproc.
Thank you so much!! :-)
I get the warning "unite:jump_list: Invalid action__line format." too.
You said earlier in this thread (august 2013) that the unite-grep settings are wrong. That is odd, because I copied the grep settings from the example from your excellent documentation.
I created a minimal Vimrc, without any plugins. The problem is reproducable. I use Gvim under Windows7.
My mnimal Vimrc:
set nocompatible
execute pathogen#infect()
syntax on
filetype plugin indent on
"Unite {
let g:unite_source_rec_async_command =
\ 'ag --follow --nocolor --nogroup --hidden -g ""'
let g:unite_source_file_async_command =
\ 'ag --follow --nocolor --nogroup --hidden -g ""'
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#profile('default', 'context', {
\ 'start_insert': 1,
\ 'winheight': 50,
\ 'direction': 'botright',
\ 'prompt': '» ',
\ })
call unite#custom#source('file,file/new,file_mru,buffer,file_rec',
\ 'matchers', 'matcher_fuzzy')
let g:unite_data_directory='~/.vim/.cache/unite'
let g:unite_source_history_yank_enable=1
if executable('ag')
let g:unite_source_grep_command='ag'
"let g:unite_source_grep_default_opts='--nocolor --nogroup -S -C4'
let g:unite_source_grep_default_opts='--nocolor --nogroup -S'
let g:unite_source_grep_recursive_opt=''
endif
let g:agprg="C:/Dropbox/Vim/vim74/ag.exe --column --smart-case"
I use the following plugins:
Unite Unite Neomru https://github.com/rking/ag.vim
I cannot use Unite grep after entering my search word, I get blocked by the message
unite:jump_list: Invalid action__line format.
OK. Please upload your grepped files. I cannot reproduce it.
And please upload reproduce ways(see issue template).
Problems summary Unite grep don't bring me to the file/line, when I searched for. I get the error message
unite:jump_list: Invalid action__line format.
if has('win32') || (' win64')
set runtimepath=$VIM/.vim,$VIMRUNTIME,$VIM/vimfiles/after,$VIM/.vim/after
endif
set nocompatible " Vi is soooo 1970. Who cares about vi?
execute pathogen#infect()
syntax on
filetype plugin indent on
let g:agprg="C:/Dropbox/Vim/vim74/ag.exe --column --smart-case"
"Unite {
let g:unite_source_rec_async_command =
\ 'ag --follow --nocolor --nogroup --hidden -g ""'
let g:unite_source_file_async_command =
\ 'ag --follow --nocolor --nogroup --hidden -g ""'
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#profile('default', 'context', {
\ 'start_insert': 1,
\ 'winheight': 50,
\ 'direction': 'botright',
\ 'prompt': '» ',
\ })
call unite#custom#source('file,file/new,file_mru,buffer,file_rec',
\ 'matchers', 'matcher_fuzzy')
let g:unite_data_directory='~/.vim/.cache/unite'
let g:unite_source_history_yank_enable=1
if executable('ag')
let g:unite_source_grep_command='ag'
let g:unite_source_grep_default_opts='--nocolor --nogroup -S -C4'
let g:unite_source_grep_recursive_opt=''
endif
I think it is Windows environment issue. Can you test it in other environment?
And your .vimrc is not minimal. It should be more reduced.
Please use set rtp+={plugin path}
instead of pathogen.
I get it. I reproduced. It is ag arguments issue.
Please use this:
let g:unite_source_grep_default_opts='--nocolor --nogroup -S'
You said earlier in this thread (august 2013) that the unite-grep settings are wrong. That is odd, because I copied the grep settings from the example from your excellent documentation.
No. It is in documentation arguments:
" Use ag in unite grep source.
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts =
\ '-i --line-numbers --nocolor --nogroup --hidden --ignore ' .
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
let g:unite_source_grep_recursive_opt = ''
I changed it to
let g:unite_source_grep_default_opts='--nocolor --nogroup -S'
Your solution is not working, I still get the same message. Then I tried another solution.
let g:unite_source_grep_default_opts='-i --nocolor --nogroup -S'
Worked for me, oddly.
The following command
:Unite vimgrep:%:\CTODO:\|FIXME:\|NOTE:
only does "vimgrep /CTODO/j %" . How should I write my vimgprep command in Unite in order to matchcase and search for todos, fixmes and notes? Thanks in advance