diff --git a/vimrc b/vimrc index 7db8f2f..40c6777 100644 --- a/vimrc +++ b/vimrc @@ -119,16 +119,61 @@ nmap x :w:!./"%" " Édition rapide de vimrc avec +e map e :e! ~/.vim/vimrc -""" Splits +""" Splits {{{ " Open new split on the bottom part set splitbelow " Open new split on the right part set splitright +" FZF function to list all files on the system {{{ +function! FzfFiles() + let tmp = tempname() + "execute '!ls | fzf >'.tmp + " Run fzf with update DEFAULT_COMMAND + " Change the prompt and preview with batcat + " Store filename in tmp + execute '!FZF_DEFAULT_COMMAND="fd -uu --type f --search-path /" fzf +\ --prompt="vi> " --preview "bat --color=always --line-range 0:50 {}" +\ >'.tmp + let g:fzffilename = readfile(tmp)[0] + silent execute '!rm '.tmp + "execute 'split '.fname +endfunction +"nnoremap :Sopen +nnoremap :silent call FzfFiles() :execute 'split '.fzffilename +" }}} + +" With fzf#run plugin WAY TO SLOW {{{ +" +"nnoremap :call fzf#run({ +"\ 'down': '40%', +"\ 'sink': 'split' }) +"nnoremap :call fzf#run({ +"\ 'down': '40%', +"\ 'sink': 'vsplit' }) + +"command! Sudosave :execute ':silent w !sudo tee % > /dev/null' | :edit! +"command! Sopen :execute ':!fd -uu --search-path / --type file | fzf +"\ --prompt="vi> " --preview "bat --color=always --line-range 0:50 {}" +"\ --no-multi' | :split +"command! Sopen :execute ':!FZF_DEFAULT_COMMAND="fd -uu --type f --search-path /" +"\ fzf --prompt="vi> " --preview "bat --color=always --line-range 0:50 {}" +"\ --no-multi' | split +"nnoremap :Sopen + +"nnoremap :call fzf#run({ +"\ 'down': '25%', +"\ 'sink': 'vertical botright split' }) +" }}} + """ Buffers " Gestion des splits map :split map :vsplit +"map :split + + + " Navigation " Détails sur les buffers: http://vim-fr.org/index.php/Buffer "map p :bp @@ -608,6 +653,9 @@ call plug#begin('~/.vim/plugged') Plug 'dracula/vim' Plug 'tomasiser/vim-code-dark' + " fzf integration + Plug 'junegunn/fzf' + " Display a tree of directories Plug 'scrooloose/nerdtree'