commit a2d76cce7c8913c1032cb111598a9df83bcb4354 Author: Bryan Ramos Date: Mon Mar 9 15:21:50 2026 -0400 initial vim config diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..5338aa3 --- /dev/null +++ b/vimrc @@ -0,0 +1,171 @@ +let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +if empty(glob(data_dir . '/autoload/plug.vim')) + silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' +endif + +autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | source $MYVIMRC + \| endif + +call plug#begin('~/.vim/plugged') + Plug 'chriskempson/base16-vim' + Plug 'tpope/vim-surround' + Plug 'jiangmiao/auto-pairs' + Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + Plug 'junegunn/fzf.vim' + Plug 'mtdl9/vim-log-highlighting' + Plug 'machakann/vim-highlightedyank' + Plug 'itchyny/lightline.vim' + Plug 'tpope/vim-fugitive' + Plug 'mhinz/vim-signify' + Plug 'osyo-manga/vim-anzu' +call plug#end() + +let mapleader = "\" +set background=dark +silent! colorscheme base16-onedark + +highlight Normal ctermbg=NONE guibg=NONE +highlight NonText ctermbg=NONE guibg=NONE +highlight CursorLine ctermbg=NONE guibg=NONE +highlight CursorLineNr ctermfg=Yellow guifg=#FFCC66 ctermbg=NONE guibg=NONE cterm=bold +highlight HighlightedyankRegion ctermfg=Black guifg=#FFFFFF ctermbg=Yellow guibg=#FFA500 +highlight NormalNC ctermbg=NONE guibg=NONE +highlight Search ctermfg=Black guifg=#000000 ctermbg=Yellow guibg=#FFCC66 +highlight LineNr ctermbg=NONE guibg=NONE +highlight Visual ctermbg=LightGray guibg=#E8E8E8 ctermfg=Black guifg=#000000 + +let g:highlightedyank_highlight_duration = 140 +let g:lightline = { 'colorscheme': 'deus', } + +let $FZF_DEFAULT_OPTS = '--bind=tab:up,shift-tab:down' +let g:fzf_layout = { 'window': 'enew' } + +" netrw settings +let g:netrw_banner = 0 +let g:netrw_winsize = 20 +let g:netrw_liststyle = 3 +let g:netrw_browse_split = 4 +let g:netrw_altv = 1 + +autocmd FileType netrw nnoremap :wincmd l +autocmd FileType netrw nnoremap :wincmd h +autocmd FileType netrw nnoremap :wincmd j +autocmd FileType netrw nnoremap :wincmd k + +set laststatus=2 + +set number +set relativenumber +set cursorline +set scrolloff=8 + +set noincsearch +set ignorecase +set smartcase + +set clipboard=unnamedplus +set noswapfile +set nobackup +set undofile +set undodir=~/.vim/undodir + +set hidden + +set tabstop=2 +set shiftwidth=2 +set expandtab + +set statusline=%{exists('*anzu#search_status')?anzu#search_status():''} + +" --- Netrw toggle (like neo-tree) --- +function! NetrwToggle() + for i in range(1, winnr('$')) + if getbufvar(winbufnr(i), '&filetype') ==# 'netrw' + execute i . 'wincmd w' + close + return + endif + endfor + let g:netrw_return_win = winnr() + Lexplore +endfunction + +function! SafeWincmd(dir) + let target = winnr(a:dir) + if target == winnr() + return + endif + if getbufvar(winbufnr(target), '&filetype') ==# 'netrw' + return + endif + execute 'wincmd ' . a:dir +endfunction + +" --- Plugin management --- +nnoremap pu :PlugUpdate +nnoremap pd :PlugUpgrade +nnoremap ps :PlugStatus +nnoremap pi :PlugInstall + +" --- Search (anzu) --- +nmap n (anzu-n-with-echo) +nmap N (anzu-N-with-echo) +nmap * (anzu-star-with-echo) +nmap # (anzu-sharp-with-echo) +nmap (anzu-clear-search-status) +nnoremap :noh + +" --- Visual indentation --- +vnoremap < >gv + +" --- Scrolling (centered) --- +nnoremap zz +nnoremap zz + +" --- Window navigation (matches nvim , skips netrw) --- +nnoremap :call SafeWincmd('h') +nnoremap :call SafeWincmd('j') +nnoremap :call SafeWincmd('k') +nnoremap :call SafeWincmd('l') + +" --- Window resize (matches nvim ) --- +nnoremap :vertical resize +10 +nnoremap :vertical resize -10 +nnoremap :resize +10 +nnoremap :resize -10 + +" --- Window management --- +nnoremap wh :split +nnoremap wv :vsplit +nnoremap wd :q +nnoremap ww :wincmd w +nnoremap wW :wincmd W + +" --- Git (fugitive) --- +nnoremap gs :Git status +nnoremap gl :Git log +nnoremap ga :Git add +nnoremap gc :Git commit +nnoremap gd :Git diff +nnoremap gb :Git blame + +" --- File explorer & search --- +nnoremap e :call NetrwToggle() +nnoremap / :Rg +nnoremap ff :Files +nnoremap fp :History +nnoremap fb :Buffers +nnoremap ? :History: + +" --- Buffers --- +nnoremap bd :bd! +nnoremap H :bprevious +nnoremap L :bnext + +" --- Terminal --- +nnoremap t :below terminal ++rows=10 + +" --- Misc --- +nnoremap ts :execute "normal! a" . strftime('[%b %d %H:%M:%S - BR]')