Files
dotfiles/.vimrc
2025-12-07 17:42:41 +00:00

76 lines
1.5 KiB
VimL

" Essential
set nocompatible
filetype plugin indent on
set encoding=utf-8
" Settings
let mapleader=" "
set noswapfile
set number relativenumber
set ruler
set noerrorbells
set laststatus=2
set showmode
set showcmd
set wildmenu
set splitbelow splitright
set hidden
" Indentation
set expandtab
set smartindent
set shiftwidth=4
set tabstop=4
set softtabstop=4
set list
set listchars=lead,tab:··
highlight SpecialKey ctermfg=8 guifg=#3c3c3c
" Search
set ignorecase
set smartcase
set hlsearch
set incsearch
set showmatch
set wildignore=**/node_modules/**,*.o,*.class
set path=.,**
" Keybindings
imap JJ <ESC>
nnoremap <silent> <Tab> :bnext<CR>
nnoremap <silent> <S-Tab> :bprevious<CR>
nnoremap <silent> <leader>x :bd!<CR>
nnoremap <silent> <Tab> :bnext<CR>
nnoremap <silent> <leader>h :noh<CR>
nnoremap <silent> <C-n> :Exp<CR>
" Commands
" Set indent style for current buffer.
function! s:SetIndent(size, use_spaces) abort
let l:size = a:size ==# "" ? 4 : str2nr(a:size)
if l:size <= 0
let l:size = 4
endif
let &l:shiftwidth = l:size
let &l:tabstop = l:size
let &l:softtabstop = l:size
let &l:expandtab = l:size
endfunction
command! -nargs=? Tabs call s:SetIndent(<q-args>, 0)
command! -nargs=? Spaces call s:SetIndent(<q-args>, 1)
" Autocmd
augroup Custom
autocmd!
autocmd FileType typescript,typescriptreact compiler tsc
autocmd FileType go Tabs 4
augroup END
" Theme
highlight QuickFixLine ctermfg=White ctermbg=NONE cterm=NONE