" ============================================================================ " Modern Vim Configuration " ============================================================================ " ---------------------------------------------------------------------------- " Vim-Plug Plugin Manager " ---------------------------------------------------------------------------- call plug#begin('~/.vim/plugged') " fzf - Blazing fast fuzzy finder (written in Go) Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' " Essential editing plugins Plug 'tpope/vim-sensible' " Sensible defaults Plug 'tpope/vim-commentary' " Easy commenting (gc) Plug 'tpope/vim-surround' " Surround text objects (cs, ds, ys) Plug 'tpope/vim-repeat' " Better . repeat for plugins " UI improvements Plug 'itchyny/lightline.vim' " Lightweight statusline Plug 'machakann/vim-highlightedyank' " Highlight yanked text briefly " Markdown Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npx --yes yarn install' } " Color schemes Plug 'joshdick/onedark.vim' " Modern dark theme (similar to VS Code) call plug#end() " ---------------------------------------------------------------------------- " General Settings " ---------------------------------------------------------------------------- set number " Show line numbers set showcmd " Show command in bottom bar set wildmenu " Visual autocomplete for command menu set mouse=a " Enable mouse support " Search settings set ignorecase " Ignore case when searching set smartcase " Unless uppercase is used set hlsearch " Highlight search results set incsearch " Incremental search " Indentation set tabstop=2 " Visual spaces per TAB set softtabstop=2 " Spaces per TAB when editing set shiftwidth=2 " Spaces for autoindent set expandtab " Tabs are spaces set smartindent " Smart autoindenting " Performance set updatetime=300 " Faster completion (default 4000ms) set timeoutlen=500 " Faster key sequence completion set ttyfast " Faster terminal connection set synmaxcol=300 " Only syntax highlight first 300 columns " Backups set nobackup " No backup files set nowritebackup " No backup before overwriting set noswapfile " No swap files " Visual syntax enable " Enable syntax highlighting set background=dark " Dark background set termguicolors " True color support " Try to load onedark, fallback to default if not installed yet try colorscheme onedark catch " OneDark not installed yet, will work after PlugInstall endtry " Custom highlighting for line numbers (dimmer, like your editor) highlight LineNr ctermfg=240 guifg=#5c6370 highlight CursorLineNr ctermfg=250 guifg=#abb2bf " Enable italic comments highlight Comment cterm=italic gui=italic " Better split behavior set splitbelow " Horizontal splits below set splitright " Vertical splits to the right " Persistent undo set undofile " Save undo history set undodir=~/.vim/undo " Undo directory if !isdirectory(expand('~/.vim/undo')) call mkdir(expand('~/.vim/undo'), 'p') endif " ---------------------------------------------------------------------------- " fzf Configuration (Much Faster Than CtrlP) " ---------------------------------------------------------------------------- " Use fd for better performance, falling back to git ls-files then find " Always excludes node_modules and dist if executable('fd') let $FZF_DEFAULT_COMMAND = 'fd --type f --hidden --follow --exclude node_modules --exclude dist --exclude .git' else let $FZF_DEFAULT_COMMAND = 'git ls-files --cached --others --exclude-standard 2>/dev/null || find . -type f -not -path "*/node_modules/*" -not -path "*/dist/*" -not -path "*/.git/*"' endif " fzf layout - bottom split with 40% height let g:fzf_layout = { 'down': '40%' } " Customize fzf colors to match Vim color scheme let g:fzf_colors = \ { 'fg': ['fg', 'Normal'], \ 'bg': ['bg', 'Normal'], \ 'hl': ['fg', 'Comment'], \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], \ 'border': ['fg', 'Ignore'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], \ 'spinner': ['fg', 'Label'], \ 'header': ['fg', 'Comment'] } " Disable preview by default (toggle with ctrl-/ for speed) let g:fzf_preview_window = ['right:50%:hidden', 'ctrl-/'] " ---------------------------------------------------------------------------- " Lightline Configuration " ---------------------------------------------------------------------------- set laststatus=2 " Always show statusline set noshowmode " Don't show mode (lightline shows it) let g:lightline = { \ 'colorscheme': 'onedark', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'readonly', 'filename', 'modified' ] ], \ }, \ } " ---------------------------------------------------------------------------- " Key Mappings " ---------------------------------------------------------------------------- " Set leader key to space let mapleader = " " " Quick save nnoremap w :w " Quick quit nnoremap q :q " Clear search highlighting nnoremap :nohlsearch " Better window navigation nnoremap h nnoremap j nnoremap k nnoremap l " fzf shortcuts (same as CtrlP for muscle memory) nnoremap p :Files nnoremap b :Buffers nnoremap m :History nnoremap f :Rg nnoremap :Files " Move lines up/down in visual mode vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv " Better indenting in visual mode vnoremap < >gv " ---------------------------------------------------------------------------- " Auto Commands " ---------------------------------------------------------------------------- " Return to last edit position when opening files augroup LastPosition autocmd! autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END " Remove trailing whitespace on save augroup TrimWhitespace autocmd! autocmd BufWritePre * :%s/\s\+$//e augroup END " Highlight yanked text briefly (vim-highlightedyank plugin handles this) " Note: lua vim.highlight.on_yank only works in Neovim, removed to avoid errors