" Vim Configuration Template (~/.vimrc)
" Documentation: https://vimhelp.org/
" Deployed by `infra setup vim` (preserve non-empty existing via *.infra sidecar).

set nocompatible
filetype plugin indent on

" --- General ---
set number
set relativenumber
set history=1000
set showcmd
set cursorline
set wildmenu
set showmatch
set incsearch
set hlsearch
set ignorecase
set smartcase
set backspace=indent,eol,start
set encoding=utf-8
set mouse=a

" --- Indentation ---
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set autoindent
set smartindent

" --- UI ---
syntax on
set laststatus=2
set t_Co=256

" --- Backup & Swap (prefer undo dir over clutter) ---
set nobackup
set nowritebackup
set noswapfile
set undofile
set undodir=~/.cache/vim/undo

" --- Keys ---
let mapleader = ","
nnoremap <leader>l :nohlsearch<cr>
nmap <leader>w :w!<cr>

" --- Filetypes ---
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType json setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType python setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType terraform,hcl setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType markdown setlocal wrap linebreak
