From 6a1bba6bbda5e0054c70eefc9c262eefa430d948 Mon Sep 17 00:00:00 2001 From: bretello Date: Sun, 26 Sep 2021 17:32:11 +0200 Subject: [PATCH] add more fzf goodies --- aliases.sh | 4 ++++ antibody_plugins.txt | 2 +- vim/plugins_config.vim | 4 ++++ vim/plugs.vim | 11 +++++++++-- vim/shortcuts.vim | 8 ++++---- vim/vimrc | 2 ++ 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/aliases.sh b/aliases.sh index a1880bc..7fda5a1 100755 --- a/aliases.sh +++ b/aliases.sh @@ -92,6 +92,10 @@ alias pvim='poetry run vim' alias pshell='poetry shell' alias venv='source .venv/bin/activate' +# Run fzf with file preview +alias pf="fzf --preview='BAT_STYLE='header,changes' bat --color=always {}' --bind shift-up:preview-page-up,shift-down:preview-page-down" +alias fgitlog="git log --oneline | fzf --multi --preview 'git -p show --color=always {+1}" + # dotfiles user aliases if [[ -f ~/.dotfiles_aliases ]]; then source $HOME/.dotfiles_aliases diff --git a/antibody_plugins.txt b/antibody_plugins.txt index 9ad110b..2a5762f 100644 --- a/antibody_plugins.txt +++ b/antibody_plugins.txt @@ -14,7 +14,7 @@ robbyrussell/oh-my-zsh path:plugins/pyenv robbyrussell/oh-my-zsh path:plugins/pylint robbyrussell/oh-my-zsh path:plugins/sudo robbyrussell/oh-my-zsh path:plugins/vi-mode -robbyrussell/oh-my-zsh path:plugins/zsh-navigation-tools +robbyrussell/oh-my-zsh path:plugins/fzf robbyrussell/oh-my-zsh path:plugins/zsh_reload zdharma/fast-syntax-highlighting zsh-users/zsh-autosuggestions diff --git a/vim/plugins_config.vim b/vim/plugins_config.vim index 93e4cdf..b3c932b 100644 --- a/vim/plugins_config.vim +++ b/vim/plugins_config.vim @@ -177,3 +177,7 @@ let g:ackprg = 'rg --vimgrep --no-heading' "" Quickpeek " Automatically open the quickpeek window let g:quickpeek_auto = v:true + + +"" Fzf +let g:fzf_layout = { 'down': '~40%' }" diff --git a/vim/plugs.vim b/vim/plugs.vim index 3bd491a..1e51ca7 100644 --- a/vim/plugs.vim +++ b/vim/plugs.vim @@ -40,8 +40,15 @@ Plug 'https://github.com/maxbrunsfeld/vim-yankstack' " Mark indentation level Plug 'https://github.com/nathanaelkane/vim-indent-guides' -" Quickpeek -Plug 'https://github.com/AndrewRadev/quickpeek.vim' +" Meson + Ninja +Plug 'https://github.com/igankevich/mesonic' + +if g:uname == "Darwin" + " mac + Plug '/usr/local/opt/fzf' +elseif g:uname == "Linux" + Plug '/usr/bin/fzf' +end " snipmate Plug 'https://github.com/MarcWeber/vim-addon-mw-utils' diff --git a/vim/shortcuts.vim b/vim/shortcuts.vim index 28d5420..ad534d2 100644 --- a/vim/shortcuts.vim +++ b/vim/shortcuts.vim @@ -92,7 +92,8 @@ map nn :NERDTreeToggle "" CtrlP " Quickly find and open a recently opened file map o :CtrlPBuffer -map j :CtrlP +map j :call fzf#run({'sink': 'edit', 'options': '--preview="BAT_STYLE=header,changes bat --color=always {}"', 'down': '40%'}) + map f :CtrlPMRUFiles map T :CtrlPBufTag map t :CtrlPTag @@ -111,10 +112,9 @@ nmap za :Goyo 80%x85% nmap zz :Goyo ""Misc stuff -let s:uname = system('uname | tr -d "\n"') " Get platform name (stripping the trailing newline) -if s:uname == "Darwin" +if g:uname == "Darwin" "" Mac specific stuff -elseif s:uname == "Linux" +elseif g:uname == "Linux" "" Linux specific stuff function! s:WaylandYank() if v:event['regname'] == '+' || (v:event['regname'] == 'w' && s:plus_to_w) diff --git a/vim/vimrc b/vim/vimrc index dda6358..99f57ac 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,4 +1,6 @@ " Install all plugins +let g:uname = system('uname | tr -d "\n"') " Get platform name (stripping the trailing newline) + source $DOTFILES/vim/plugs.vim " Sanity