Skip to content

Instantly share code, notes, and snippets.

@gayanhewa
Last active December 21, 2016 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gayanhewa/2311db57ee2ec863c713fffe47a40351 to your computer and use it in GitHub Desktop.
Save gayanhewa/2311db57ee2ec863c713fffe47a40351 to your computer and use it in GitHub Desktop.
Vimrc
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'ervandew/supertab'
Plug 'shawncplus/phpcomplete.vim'
Plug 'tpope/vim-fugitive'
Plug 'bling/vim-bufferline'
Plug 'mileszs/ack.vim'
call plug#end()
set nocompatible
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
set completeopt=longest,menuone
filetype indent plugin on
syntax on
set hidden
set wildmenu
set showcmd
set backspace=indent,eol,start
set autoindent
set nostartofline
set ruler
set laststatus=2
set confirm
set visualbell
set mouse=a
set cmdheight=2
set number
set notimeout ttimeout ttimeoutlen=200
set pastetoggle=<F11>
set shiftwidth=4
set softtabstop=4
set expandtab
set ignorecase
nmap <C-r> ::FZF<CR>
nmap <C-n> :bNext<CR>
let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
let g:fzf_tags_command = 'ctags -R'
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
function! s:escape(path)
return substitute(a:path, ' ', '\\ ', 'g')
endfunction
function! AgHandler(line)
let parts = split(a:line, ':')
let [fn, lno] = parts[0 : 1]
execute 'e '. s:escape(fn)
execute lno
normal! zz
endfunction
command! -nargs=+ Fag call fzf#run({
\ 'source': 'ag "<args>"',
\ 'sink': function('AgHandler'),
\ 'options': '+m',
\ 'tmux_height': '60%'
\ })
@gayanhewa
Copy link
Author

Adding ack.vim to use ag. Ensure you have ag installed for searches to use ag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment