vim/nvim: update file/search cmd

This commit is contained in:
Marco Thomas
2023-04-10 09:59:28 +02:00
parent ec3da77ac7
commit 3d0d95a4bb
3 changed files with 10 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
" ~/.vimrc
"
" ~ M. Thomas
" ~ M. Thomas
let mapleader = "\<Space>"
@@ -108,27 +108,15 @@ let g:netrw_liststyle = 3 " Tree-like structure
let g:netrw_banner = 0 " Remove useless banner at the top of netrw
" ============================== Macros and Mappings
" fzf
map <C-f> :Files<CR>
map <C-g> :GFiles<CR>
" file interaction
let g:fzf_preview_window = ['down,50%', 'ctrl-/']
command! -bang -nargs=* GGrep
\ call fzf#vim#grep(
\ 'git grep --line-number -- '.shellescape(<q-args>), 0,
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
\ fzf#vim#with_preview(), <bang>0)
let rgcheck = system("which rg 2> /dev/null")
if v:shell_error == 0
map <C-s> :Rg<CR>
else
map <C-s> :GGrep<CR>
endif
" git
map <leader>gs :Git status<CR>
map <leader>gb :Git blame<CR>
" other
map <C-_> :noh<CR>
map <C-p> :Files<CR>
map <C-f> :GGrep
fun! TrimWhitespace()
let l:save = winsaveview()