TerryFunggg / bookshelf

0 stars 0 forks source link

Vim ag config #7

Open pigfly321 opened 2 days ago

pigfly321 commented 2 days ago

https://thoughtbot.com/blog/faster-grepping-in-vim

pure config without Ag vim-plugin.

pigfly321 commented 1 day ago

set nocompatible filetype on filetype plugin on filetype indent on syntax on set number set cursorline

set tabstop=2 set expandtab set nobackup set nowrap set incsearch set ignorecase set smartcase set scrolloff=10 set showmode set showmatch set wildmenu set wildmode=list:longest set wildignore=.docx,.jpg,.png,.gif,.pdf,.pyc,.exe,.flv,.img,.xlsx

" The Silver Searcher if executable('ag') set grepprg=ag\ --nogroup\ --nocolor let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' let g:ctrlp_use_caching = 0 endif

" Search word under the cursor with K key nnoremap K :grep! "\b\b":cw

" Ag command command -nargs=+ -complete=file -bar Ag silent! grep! |cwindow|redraw! " bind to key: nnoremap \ :Ag command -nargs=+ -complete=file -bar Find silent! find |cwindow|redraw!

" find files and populate the quickfix list fun! FindFiles(filename) let error_file = tempname() silent exe '!find . -type f -name "'.a:filename.'" | xargs file | sed "s/:/:1:/" > '.error_file set errorformat=%f:%l:%m exe "cfile ". error_file copen call delete(error_file) endfun command! -nargs=1 FindFile call FindFiles()

colorscheme ron