Skip to content

Instantly share code, notes, and snippets.

@S1M0N38
Created November 10, 2022 10:26
Show Gist options
  • Save S1M0N38/99bd728d1d25e7de77db8ef53213e58e to your computer and use it in GitHub Desktop.
Save S1M0N38/99bd728d1d25e7de77db8ef53213e58e to your computer and use it in GitHub Desktop.
Minimal configuration for vim
" Improving on minimal vim configuration at
"
" https://github.com/lemonase/dotfiles/blob/
" ab2d279804a8a6b5e6862012c13bd22b64076431/
" config/vim/.vim/vimrc.min
"
"load system defaults
if filereadable(expand('$VIMRUNTIME/defaults.vim'))
unlet! g:skip_defaults_vim
source $VIMRUNTIME/defaults.vim
endif
"regular settings
"----------------
" leader
nnoremap <SPACE> <Nop>
let mapleader=" "
" ui
set number
set ruler
set wildmenu
set showcmd
set showmatch
" cursor shape based on mode
if exists('$TMUX')
let &t_SI = "\ePtmux;\e\e[5 q\e\\"
let &t_EI = "\ePtmux;\e\e[2 q\e\\"
else
let &t_SI = "\e[5 q"
let &t_EI = "\e[2 q"
endif
" encoding/format
set encoding=utf-8
set fileformats=unix,dos,mac
" searching
set hlsearch!
set incsearch
set ignorecase
set smartcase
nnoremap <silent> <leader>h :noh<CR>
" indent
set expandtab
set shiftwidth=4
set tabstop=4
set autoindent
" key timeout values
set esckeys
set ttimeoutlen=20
set timeoutlen=1000
" allow syntax and filetype plugins
syntax enable
filetype plugin indent on
runtime macros/matchit.vim
" disable caches
set viminfo=
set noswapfile
set nobackup
set nowritebackup
" disable bell
set belloff=all
" autocmds
"---------
augroup general
autocmd!
"keep equal proportions when windows resized
autocmd VimResized * wincmd =
"save cursor position in a file
autocmd BufReadPost * if line("'\"") > 1 && line("'\"")
\ <= line("$") | exe "normal! g'\"" | endif
augroup END
augroup languages
autocmd!
autocmd BufNewFile,BufRead *.bash set syntax=sh
autocmd FileType html :syntax sync fromstart
autocmd FileType html,javascript,css,json,yaml,sh,vim
\ setlocal ts=2 sts=2 sw=2 expandtab
augroup END
@S1M0N38
Copy link
Author

S1M0N38 commented Nov 10, 2022

From your $HOME directory download with

curl -O https://gist.githubusercontent.com/S1M0N38/99bd728d1d25e7de77db8ef53213e58e/raw/1b2ca9c75e4edd2d6e493c4a47888b42f7ba81e8/.vimrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment