" josie.lol vimrc
" A sensible vim configuration for productivity

" Basic settings
set nocompatible
syntax on
filetype plugin indent on
set encoding=utf-8
set number
set relativenumber
set cursorline
set showmatch
set hlsearch
set incsearch
set ignorecase
set smartcase
set autoindent
set smartindent
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set backspace=indent,eol,start
set ruler
set showcmd
set wildmenu
set wildmode=list:longest
set laststatus=2
set scrolloff=3
set sidescrolloff=5
set wrap
set linebreak
set mouse=a
set clipboard=unnamedplus

" Visual improvements
set background=dark
colorscheme default
set t_Co=256

" Backup and swap files
set nobackup
set nowritebackup
set noswapfile

" Search and replace
set gdefault
nnoremap / /\v
vnoremap / /\v

" Leader key mappings
let mapleader = ","
nnoremap <leader>w :w<CR>
nnoremap <leader>q :q<CR>
nnoremap <leader>x :x<CR>
nnoremap <leader>h :noh<CR>

" Navigation
nnoremap j gj
nnoremap k gk
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

" File type specific settings
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType yml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType json setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType typescript setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType go setlocal ts=4 sts=4 sw=4 noexpandtab

" Remove trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e

" Status line
set statusline=%f\ %m%r%h%w\ [%Y]\ [%{&ff}]\ %=%l,%c\ %p%%

" Performance optimizations
set ttyfast
set lazyredraw

" Security
set modelines=0

" Persistent undo
if has('persistent_undo')
    set undodir=~/.vim/undo
    set undofile
endif