From 024b6ee2445e8deb03fa2f062bd62fb6f8ae9b96 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Thu, 7 May 2026 11:02:27 -0400 Subject: [PATCH] lied --- vimrc | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/vimrc b/vimrc index b57349c..0f5b354 100644 --- a/vimrc +++ b/vimrc @@ -144,6 +144,23 @@ function! GitRoot() return getcwd() endfunction +function! FzfRg() + if exists(':Rg') != 2 + echohl WarningMsg | echom 'fzf.vim :Rg command is not available' | echohl None + return + endif + if !executable('rg') + echohl WarningMsg | echom 'ripgrep executable "rg" is not available' | echohl None + return + endif + let l:query = input('Rg: ') + if empty(l:query) + return + endif + execute 'lcd ' . fnameescape(GitRoot()) + execute 'Rg ' . escape(l:query, '|') +endfunction + function! SafeBdelete() if &filetype ==# 'netrw' echohl WarningMsg | echom 'Cannot delete buffer from netrw' | echohl None @@ -184,10 +201,11 @@ nnoremap zz nnoremap zz " --- Window navigation (skips netrw) --- -nnoremap :call SafeWincmd('h') -nnoremap :call SafeWincmd('j') -nnoremap :call SafeWincmd('k') -nnoremap :call SafeWincmd('l') +nnoremap :call SafeWincmd('h') +nnoremap :call SafeWincmd('h') +nnoremap :call SafeWincmd('j') +nnoremap :call SafeWincmd('k') +nnoremap :call SafeWincmd('l') " --- Window resize --- nnoremap :vertical resize +10 @@ -205,7 +223,7 @@ nnoremap wW :wincmd W " --- File explorer & search --- nnoremap e :call NetrwToggle() -nnoremap / :execute 'lcd ' . fnameescape(GitRoot()) Rg +nnoremap / :call FzfRg() nnoremap ff :execute 'lcd ' . fnameescape(GitRoot()) Files nnoremap fp :History nnoremap fb :Buffers