" navigation.vim — FZF, netrw, buffer/window management, terminal " ── netrw (built-in file browser) ─────────────────────────────────────────── let g:netrw_liststyle = 3 let g:netrw_banner = 0 let g:netrw_browse_split = 0 let g:netrw_winsize = 25 let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+' let g:netrw_list_hide .= ',\.pyc$,node_modules,\.git,__pycache__,\.DS_Store' nnoremap e :Explore nnoremap E :Vexplore " ── FZF ───────────────────────────────────────────────────────────────────── function! s:SmartFiles() abort if isdirectory('.git') || finddir('.git', '.;') !=# '' GFiles else Files endif endfunction if exists('g:plugs["fzf.vim"]') nnoremap :call SmartFiles() nnoremap b :Buffers nnoremap rg :Rg nnoremap rG :RgWord nnoremap rt :Tags nnoremap gF :GFiles nnoremap fh :History nnoremap fc :Commands nnoremap fm :Marks nnoremap fl :BLines nnoremap fL :Lines nnoremap f/ :History/ nnoremap f: :History: endif let g:fzf_layout = { 'down': '40%' } if g:is_tty let g:fzf_preview_window = [] else let g:fzf_preview_window = ['right:50%', 'ctrl-/'] endif if g:is_tty command! -bang -nargs=* Rg \ call fzf#vim#grep( \ 'rg --column --line-number --no-heading --color=always --smart-case -- ' \ .shellescape(), 1, 0) command! -bang GFiles call fzf#vim#gitfiles('', 0) else command! -bang -nargs=* Rg \ call fzf#vim#grep( \ 'rg --column --line-number --no-heading --color=always --smart-case -- ' \ .shellescape(), 1, fzf#vim#with_preview(), 0) command! -bang GFiles call fzf#vim#gitfiles('', fzf#vim#with_preview(), 0) endif if g:is_tty command! -bang -nargs=* RgWord \ call fzf#vim#grep( \ 'rg --column --line-number --no-heading --color=always --smart-case -F -- ' \ .shellescape(expand('')), 1, 0) else command! -bang -nargs=* RgWord \ call fzf#vim#grep( \ 'rg --column --line-number --no-heading --color=always --smart-case -F -- ' \ .shellescape(expand('')), 1, fzf#vim#with_preview(), 0) endif " ── Window Maximize Toggle ────────────────────────────────────────────────── function! s:ToggleMaximize() abort if exists('t:maximize_session') execute t:maximize_session unlet t:maximize_session else let t:maximize_session = winrestcmd() resize | vertical resize endif endfunction nnoremap z :call ToggleMaximize() " ── Terminal ──────────────────────────────────────────────────────────────── if has('terminal') nnoremap tv :terminal nnoremap th :terminal ++rows=10 tnoremap tnoremap h tnoremap j tnoremap k tnoremap l endif