Added ability for fzf to go ..

This commit is contained in:
z3rOR0ne 2022-09-08 07:49:42 -07:00
parent 6c3ac0b4f3
commit e81f3457e3
2 changed files with 20 additions and 7 deletions

View file

@ -25,7 +25,7 @@ require'nvim-treesitter.configs'.setup{
-- Disable folds
vim.g.nofoldenable = true
--
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.on_server_ready(function(server)
@ -346,6 +346,22 @@ vim.cmd[[function TrimWhiteSpace()
''
endfunction]]
-- Search pattern across repository files
vim.cmd[[
function! FzfExplore(...)
let inpath = substitute(a:1, "'", '', 'g')
if inpath == "" || matchend(inpath, '/') == strlen(inpath)
execute "cd" getcwd() . '/' . inpath
let cwpath = getcwd() . '/'
call fzf#run(fzf#wrap(fzf#vim#with_preview({'source': 'ls -1ap', 'dir': cwpath, 'sink': 'FZFExplore', 'options': ['--prompt', cwpath]})))
else
let file = getcwd() . '/' . inpath
execute "e" file
endif
endfunction]]
vim.cmd[[command! -nargs=* FZFExplore call FzfExplore(shellescape(<q-args>))]]
--Removes trailing spaces on save
vim.cmd[[autocmd FileWritePre * call TrimWhiteSpace()]]
vim.cmd[[autocmd FileAppendPre * call TrimWhiteSpace()]]