mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Convert fzf.vim to fzf.lua
This commit is contained in:
parent
e8fb4e3614
commit
9aeb792628
39
home/.config/nvim/lua/plugins.d/fzf.lua
Normal file
39
home/.config/nvim/lua/plugins.d/fzf.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
local vim = require("vim")
|
||||||
|
local cmd = vim.cmd
|
||||||
|
local g = vim.g
|
||||||
|
|
||||||
|
cmd[[Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }]]
|
||||||
|
cmd[[Plug 'junegunn/fzf.vim']]
|
||||||
|
cmd[[Plug 'stsewd/fzf-checkout.vim']]
|
||||||
|
|
||||||
|
g.fzf_layout = {
|
||||||
|
up = '~90%',
|
||||||
|
window = {
|
||||||
|
width = 0.8,
|
||||||
|
height = 0.8,
|
||||||
|
yoffset = 0.5,
|
||||||
|
offset = 0.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd[[let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline']]
|
||||||
|
|
||||||
|
-- Customize the Files command to use ripgrep which respects .gitignore files
|
||||||
|
cmd[[
|
||||||
|
command! -bang -nargs=? -complete=dir Files
|
||||||
|
\ call fzf#run(fzf#wrap('files', fzf#vim#with_preview({ 'dir': <q-args>, 'sink': 'e', 'source': 'rg --files --hidden' }), <bang>0))
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Add an AllFiles variation that shows ignored files too
|
||||||
|
cmd[[
|
||||||
|
command! -bang -nargs=? -complete=dir AllFiles
|
||||||
|
\ call fzf#run(fzf#wrap('allfiles', fzf#vim#with_preview({ 'dir': <q-args>, 'sink': 'e', 'source': 'rg --files --hidden --no-ignore' }), <bang>0))
|
||||||
|
]]
|
||||||
|
|
||||||
|
Keymap("n", "<leader>f", ":Files<CR>")
|
||||||
|
Keymap("n", "<leader>F", ":AllFiles<CR>")
|
||||||
|
Keymap("n", "<leader>b", ":Buffers<CR>")
|
||||||
|
Keymap("n", "<leader>h", ":History<CR>")
|
||||||
|
Keymap("n", "<leader>r", ":Rg<CR>")
|
||||||
|
Keymap("n", "<leader>R", ":Rg<space>", { silent = false })
|
||||||
|
Keymap("n", "<leader>gb", ":GBranches<CR>")
|
|
@ -1,22 +0,0 @@
|
||||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
|
||||||
Plug 'junegunn/fzf.vim'
|
|
||||||
Plug 'stsewd/fzf-checkout.vim'
|
|
||||||
|
|
||||||
let g:fzf_layout = { 'up': '~90%', 'window': { 'width': 0.8, 'height': 0.8, 'yoffset':0.5, 'xoffset': 0.5 } }
|
|
||||||
let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline'
|
|
||||||
|
|
||||||
" Customise the Files command to use ripgrep which respects .gitignore files
|
|
||||||
command! -bang -nargs=? -complete=dir Files
|
|
||||||
\ call fzf#run(fzf#wrap('files', fzf#vim#with_preview({ 'dir': <q-args>, 'sink': 'e', 'source': 'rg --files --hidden' }), <bang>0))
|
|
||||||
|
|
||||||
" Add an AllFiles variation that shows ignored files too
|
|
||||||
command! -bang -nargs=? -complete=dir AllFiles
|
|
||||||
\ call fzf#run(fzf#wrap('allfiles', fzf#vim#with_preview({ 'dir': <q-args>, 'sink': 'e', 'source': 'rg --files --hidden --no-ignore' }), <bang>0))
|
|
||||||
|
|
||||||
nmap <leader>f :Files<cr>
|
|
||||||
nmap <leader>F :AllFiles<cr>
|
|
||||||
nmap <leader>b :Buffers<cr>
|
|
||||||
nmap <leader>h :History<cr>
|
|
||||||
nmap <leader>r :Rg<cr>
|
|
||||||
nmap <leader>R :Rg<space>
|
|
||||||
nmap <leader>gb :GBranches<cr>
|
|
|
@ -47,7 +47,7 @@ load_plugin_file("coc.vim")
|
||||||
load_plugin_file("vimwiki.lua")
|
load_plugin_file("vimwiki.lua")
|
||||||
load_plugin_file("nerdtree.lua")
|
load_plugin_file("nerdtree.lua")
|
||||||
load_plugin_file("airline.lua")
|
load_plugin_file("airline.lua")
|
||||||
load_plugin_file("fzf.vim")
|
load_plugin_file("fzf.lua")
|
||||||
|
|
||||||
-- End Plug.vim loading process
|
-- End Plug.vim loading process
|
||||||
cmd[[call plug#end()]]
|
cmd[[call plug#end()]]
|
||||||
|
|
Loading…
Reference in a new issue