mirror of
https://github.com/itme-brain/vim.git
synced 2026-05-08 07:30:13 -04:00
lied
This commit is contained in:
parent
26fd7bbb50
commit
024b6ee244
1 changed files with 23 additions and 5 deletions
28
vimrc
28
vimrc
|
|
@ -144,6 +144,23 @@ function! GitRoot()
|
||||||
return getcwd()
|
return getcwd()
|
||||||
endfunction
|
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()
|
function! SafeBdelete()
|
||||||
if &filetype ==# 'netrw'
|
if &filetype ==# 'netrw'
|
||||||
echohl WarningMsg | echom 'Cannot delete buffer from netrw' | echohl None
|
echohl WarningMsg | echom 'Cannot delete buffer from netrw' | echohl None
|
||||||
|
|
@ -184,10 +201,11 @@ nnoremap <C-U> <C-U>zz
|
||||||
nnoremap <C-D> <C-D>zz
|
nnoremap <C-D> <C-D>zz
|
||||||
|
|
||||||
" --- Window navigation (skips netrw) ---
|
" --- Window navigation (skips netrw) ---
|
||||||
nnoremap <C-h> :call SafeWincmd('h')<CR>
|
nnoremap <silent> <C-h> :call SafeWincmd('h')<CR>
|
||||||
nnoremap <C-j> :call SafeWincmd('j')<CR>
|
nnoremap <silent> <BS> :call SafeWincmd('h')<CR>
|
||||||
nnoremap <C-k> :call SafeWincmd('k')<CR>
|
nnoremap <silent> <C-j> :call SafeWincmd('j')<CR>
|
||||||
nnoremap <C-l> :call SafeWincmd('l')<CR>
|
nnoremap <silent> <C-k> :call SafeWincmd('k')<CR>
|
||||||
|
nnoremap <silent> <C-l> :call SafeWincmd('l')<CR>
|
||||||
|
|
||||||
" --- Window resize ---
|
" --- Window resize ---
|
||||||
nnoremap <C-Right> :vertical resize +10<CR>
|
nnoremap <C-Right> :vertical resize +10<CR>
|
||||||
|
|
@ -205,7 +223,7 @@ nnoremap <leader>wW :wincmd W<CR>
|
||||||
|
|
||||||
" --- File explorer & search ---
|
" --- File explorer & search ---
|
||||||
nnoremap <leader>e :call NetrwToggle()<CR>
|
nnoremap <leader>e :call NetrwToggle()<CR>
|
||||||
nnoremap <leader>/ :execute 'lcd ' . fnameescape(GitRoot()) <Bar> Rg<Space>
|
nnoremap <leader>/ :call FzfRg()<CR>
|
||||||
nnoremap <leader>ff :execute 'lcd ' . fnameescape(GitRoot()) <Bar> Files<CR>
|
nnoremap <leader>ff :execute 'lcd ' . fnameescape(GitRoot()) <Bar> Files<CR>
|
||||||
nnoremap <leader>fp :History<CR>
|
nnoremap <leader>fp :History<CR>
|
||||||
nnoremap <leader>fb :Buffers<CR>
|
nnoremap <leader>fb :Buffers<CR>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue