Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use fzf instead of ctrl-p and ack.vim instead of ag.vim #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
tap 'thoughtbot/formulae'
brew 'rcm'
brew 'fzf'
brew 'ripgrep'
10 changes: 6 additions & 4 deletions hooks/post-up
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/sh

mkdir -p $HOME/.vim/bundle/ $HOME/.config
ln -sf $HOME/.vim $HOME/.config/nvim
ln -sf $HOME/.vimrc $HOME/.vim/init.vim

if [ ! -e $HOME/.vim/bundle/Vundle.vim ]; then
mkdir -p $HOME/.vim/bundle/
git clone https://github.com/gmarik/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
fi
vim -u $HOME/.vimrc +PluginInstall +qa -
vim -u $HOME/.vimrc +PluginClean! +qa -
vim -u $HOME/.vimrc +PluginInstall +PluginClean! +qall
57 changes: 27 additions & 30 deletions vimrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
set nocompatible
filetype on
filetype off

let mapleader = ','
Expand Down Expand Up @@ -68,50 +67,48 @@ if count(g:vimified_packages, 'general')
map \ :NERDTreeToggle<CR>
map \| :NERDTreeFind<CR>

Plugin 'ctrlpvim/ctrlp.vim'
let g:ctrlp_match_window = 'bottom,order:ttb,min:1,max:10,results:10'
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_max_files = 0

nnoremap <silent> <leader>f :CtrlP<CR>
noremap <leader>b :CtrlPBuffer<CR>
Plugin 'junegunn/fzf'
if executable('rg')
let $FZF_DEFAULT_COMMAND= 'rg -a --files'
else
let $FZF_DEFAULT_COMMAND= 'ag -g ""'
endif

Plugin 'FelikZ/ctrlp-py-matcher'
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
let $FZF_DEFAULT_OPTS= '--color dark,hl:33,hl+:37,fg+:235,bg+:136,fg+:254,info:254,prompt:37,spinner:108,pointer:235,marker:235'
nnoremap <C-p> :FZF<CR>
nnoremap <silent> <leader>f :FZF<CR>
nnoremap <silent> <leader>] :Tags <c-r>=expand("<cword>")<cr><CR>

if executable('rg')
" Use Ripgrep over Grep
set grepprg=rg\ --vimgrep\ --no-heading
set grepformat=%f:%l:%c:%m,%f:%l:%m
Plugin 'junegunn/fzf.vim'
let g:fzf_layout = {'down': '40%'}
let g:fzf_tags_command = 'ripper-tags -R'
noremap <leader>b :Buffers<CR>

let g:ctrlp_user_command = 'rg --hidden -i --files %s'
let g:ackprg = 'rg --vimgrep'
elseif executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
Plugin 'mileszs/ack.vim'

let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --ignore ".git" --ignore ".DS_Store" --hidden -g ""'
if executable('ag')
let g:ackprg = 'ag --vimgrep'
else
nnoremap <silent> <leader>F :ClearCtrlPCache<CR>\|:CtrlP<CR>
endif

Plugin 'rking/ag.vim'
function! AgGrep()
if executable('rg')
let g:ackprg = 'rg --vimgrep'
endif

function! AckGrep()
let command = g:ackprg.' -i '.expand('<cword>')
cexpr system(command)
cw
endfunction

function! AgVisual()
function! AckVisual()
normal gv"xy
let command = g:ackprg.' -i '.@x
cexpr system(command)
cw
endfunction

map <leader>a :call AgGrep()<CR>
vmap <leader>a :call AgVisual()<CR>
map <leader>a :call AckGrep()<CR>
vmap <leader>a :call AckVisual()<CR>

" File Renaming (credit: garybernhardt)
function! RenameFile()
Expand Down Expand Up @@ -571,7 +568,7 @@ endif
"
"""""""""""""""""""""""""""""""""""""""
if count(g:vimified_packages, 'colour') || count(g:vimified_packages, 'color')
Plugin 'chriskempson/tomorrow-theme', {'rtp': 'vim/'}
Plugin 'chriskempson/base16-vim'

:hi TabLineFill term=bold cterm=bold ctermbg=237
endif
Expand Down Expand Up @@ -616,8 +613,8 @@ if count(g:vimified_packages, 'coding')
endif

if count(g:vimified_packages, 'colour') || count(g:vimified_packages, 'color')
colorscheme Tomorrow-Night-Eighties
endif
colorscheme base16-tomorrow-night
end

"
" Options
Expand Down