diff vim-setup/.vimrc @ 150:c37490913530

[Config] Updated .vimrc files and made command for ctags movements.
author June Park <parkjune1995@gmail.com>
date Sat, 10 Jan 2026 13:30:28 -0800
parents 76cd7afa6b8e
children 790930d9bb90
line wrap: on
line diff
--- a/vim-setup/.vimrc	Sat Jan 10 07:07:10 2026 -0800
+++ b/vim-setup/.vimrc	Sat Jan 10 13:30:28 2026 -0800
@@ -78,8 +78,25 @@
 " <leader>fs: Ripgrep search for word (normal mode)
 nnoremap <leader>fs :RG<CR>
 
-" <leader>fs: Ripgrep search for selected text (visual mode)
-vnoremap <leader>fs :<C-u>execute 'Rg ' . getreg('"')<CR>
+" <leader>fs: Open Ripgrep search prompt
+nnoremap <leader>fs :RG<CR>
+
+function! RipgrepCursor(query)
+  call fzf#vim#grep(
+    \ 'rg --column --line-number --no-heading --color=always --smart-case -- '.shellescape(a:query),
+    \ 1,
+    \ fzf#vim#with_preview(),
+    \ 0)
+endfunction
+
+" <leader>gr: Search word under cursor (Normal)
+nnoremap <silent> <leader>gr :call RipgrepCursor(expand('<cword>'))<CR>
+
+" <leader>gr: Search selection (Visual)
+vnoremap <silent> <leader>gr y:call RipgrepCursor(@@)<CR>
+
+nnoremap <leader>gd <C-w>}
+nnoremap <leader>gD <C-]>
 
 " Open man in vim
 noremap <c-k> :h <cword><cr>
@@ -103,19 +120,15 @@
 " Keyword
 set keywordprg=:Man
 
-" -----
-" Mac specific?
-"
-" " FZF enbale vim
-" set rtp+=/opt/homebrew/opt/fzf
-"
-"  you might need to add for linux as well i forgot
-" 
-" " For some reason it include ( or ) when I use it in here
-" set iskeyword-=( iskeyword-=)
-" ------
+" FZF enbale vim
+set rtp+=/opt/homebrew/opt/fzf
 
+" For some reason it include ( or ) when I use it in here
+set iskeyword-=( iskeyword-=)
+
+" ============================================================================
 " Markdown Clipboard Image Paste
+" ============================================================================
 " Configuration: Set your API endpoint URL (leave empty to save locally)
 let g:clipboard_image_upload_url = ''