diff --git a/init.vim b/init.vim index 5c1e24e..c578ef5 100644 --- a/init.vim +++ b/init.vim @@ -92,11 +92,14 @@ " Fuzzy finding " Plug 'jhawthorn/fzy' " Install this systemwide (or configure a manual " location. See below) - Plug 'srstevenson/vim-picker' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' Plug 'jesseleite/vim-agriculture' + " vim-telescope (and dependencies) + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' } + " line indentation guides Plug 'Yggdroot/indentLine' @@ -487,46 +490,28 @@ if !(has('win32') || has('win64')) " nnoremap ¬ :PickerEdit ~/jobxx/ endif - function! CallPickerEdit() + function! FuzzyFileFinder() let l:IsInGitRepo = system('git rev-parse --is-inside-work-tree') if l:IsInGitRepo =~ 'true' let l:GitRepoDir = system('git rev-parse --show-toplevel') - execute 'PickerEdit ' . l:GitRepoDir + execute 'Telescope find_files cwd=' . l:GitRepoDir->fnameescape() else - execute 'PickerEdit ' . glob('~/') - " TODO: Verify if this works -" if $USER =~ '^knyff$' -" " TODO: Make PickerEdit work on windows -" execute 'PickerEdit C:\User\' . $USER - " PickerEdit C:\User\knyff\ -" else -" PickerEdit ~/ -" endif + execute 'Telescope find_files cwd=' . glob('~/')->fnameescape() endif endfunction - function! CallPickerPDF() - let l:IsInGitRepo = system('git rev-parse --is-inside-work-tree') - if l:IsInGitRepo =~ 'true' - " TODO: Make this work -" let l:CurrBufNr = bufnr('%') - let l:GitRepoDir = system('git rev-parse --show-toplevel') - call picker#File('git ls-files --cached --exclude-standard --others', 'te zathura', l:GitRepoDir) -" execute 'b '.l:CurrBufNr - else -" let l:OldBufNr = bufnr('%') -" echo bufnr('%') - execute 'tabedit' - call picker#File('find ' . glob('~/') . ' -type f', 'te zathura') -" let l:CurrBufNr = bufnr('%') -" echo bufnr('%') -" execute 'tabclose' -" execute 'b '.l:CurrBufNr - endif + nnoremap ¬ :call FuzzyFileFinder() + + function! OpenPDFInsteadOfBuffer() + echo expand('%')->fnameescape() + call system('zathura ' . expand('%')->fnameescape() . ' &') + bd endfunction - nnoremap ¬ :call CallPickerEdit() - nnoremap ¿ :call CallPickerPDF() + augroup OpenExternalFiles + au! + au FileType pdf call OpenPDFInsteadOfBuffer() + augroup END endif " NeoMake {{{