Permalink
Browse files

<leader>f completes relative to the current buffer workdir

  • Loading branch information...
1 parent 97d5585 commit 0821910e7971d8278a539ceec6c81d281f62f083 @caio committed Jun 19, 2016
Showing with 18 additions and 8 deletions.
  1. +18 −8 vimrc
View
@@ -90,16 +90,8 @@ let g:go_highlight_build_constraints = 1
let g:go_fmt_command = "goimports"
" {{{ fzf
-let g:fzf_buffers_jump = 1
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
-
-imap <c-x><c-f> <plug>(fzf-complete-path)
-nmap <silent><leader>f :GFiles<CR>
-nmap <silent><leader>F :GFiles<CR>
-nmap <silent><leader>b :Buffers<CR>
-nmap <silent><leader>t :BTags<CR>
-nmap <silent><leader>T :Tags<CR>
" }}}
call plug#end()
@@ -328,6 +320,24 @@ nnoremap <silent>H :call <SID>SmartHome()<CR>
nnoremap L $
" }}}
+" {{{ FZF Settings
+let g:fzf_buffers_jump = 1
+function! Fzf_git_relative_cwd()
+ let cwd = expand("%:p:h")
+ let git_dir = substitute(fnamemodify(finddir(".git", cwd.";"), ":p"), ".git/", "", "")
+ let relative_dir = substitute(cwd, substitute(git_dir, "/.git", "", ""), "", "")
+ return relative_dir
+endfunction
+
+nnoremap <silent> <leader>f :exe 'GFiles -- ' . Fzf_git_relative_cwd()<CR>
+imap <c-x><c-f> <plug>(fzf-complete-path)
+" nmap <silent><leader>f :GFiles<CR>
+nmap <silent><leader>F :GFiles<CR>
+nmap <silent><leader>b :Buffers<CR>
+nmap <silent><leader>t :BTags<CR>
+nmap <silent><leader>T :Tags<CR>
+" }}}
+
" Slime settings
let g:slime_target = "tmux"

0 comments on commit 0821910

Please sign in to comment.