Skip to content

Instantly share code, notes, and snippets.

@derekahn
Last active January 27, 2023 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derekahn/2810b0d1ea27a03584d20ab1d8d3218b to your computer and use it in GitHub Desktop.
Save derekahn/2810b0d1ea27a03584d20ab1d8d3218b to your computer and use it in GitHub Desktop.
Universal vimrc
""""""""""""""""""""""
" Settings "
""""""""""""""""""""""
colorscheme torte " Colorscheme
syntax enable " Enables syntax highlighting
filetype off " Reset filetype detection first ...
filetype plugin indent on " ... and enable filetype detection
set nocompatible " Enables us Vim specific features
set ttyfast " Indicate fast terminal conn for faster redraw
set ttymouse=xterm2 " Indicate terminal type for mouse codes
set ttyscroll=3 " Speedup scrolling
set laststatus=2 " Show status line always
set encoding=utf-8 " Set default encoding to UTF-8
set autoread " Automatically read changed files
set autoindent " Enabile Autoindent
set backspace=indent,eol,start " Makes backspace key more powerful.
set incsearch " Shows the match while typing
set hlsearch " Highlight found searches
set noerrorbells " No beeps
set number " Show line numbers
set showcmd " Show me what I'm typing
set noswapfile " Don't use swapfile
set nobackup " Don't create annoying backup files
set splitright " Vertical windows should be split to right
set splitbelow " Horizontal windows should split to bottom
set autowrite " Automatically save before :next, :make etc.
set hidden " Buffer should still exist if window is closed
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats
set noshowmatch " Do not show matching brackets by flickering
set noshowmode " We show the mode with airline or lightline
set ignorecase " Search case insensitive...
set smartcase " ... but not it begins with upper case
set smartindent " Indenting magic
set completeopt=menu,menuone " Show popup menu, even if there is one entry
set pumheight=10 " Completion window max size
set nocursorcolumn " Do not highlight column (speeds up highlighting)
set nocursorline " Do not highlight cursor (speeds up highlighting)
set lazyredraw " Wait to redraw
set tabstop=2 " Spaces view
set shiftwidth=2 " Shift spaces size
set relativenumber " Show relative numbers
set expandtab " Tab expansion
" Enable to copy to clipboard for operations like yank, delete, change and put
" http://stackoverflow.com/questions/20186975/vim-mac-how-to-copy-to-clipboard-without-pbcopy
if has('unnamedplus')
set clipboard^=unnamed
set clipboard^=unnamedplus
endif
" This enables us to undo files even if you exit Vim.
if has('persistent_undo')
set undofile
set undodir=~/.config/vim/tmp/undo//
endif
""""""""""""""""""""""
" Mappings "
""""""""""""""""""""""
" Exit insert mode with `jj`
inoremap jj <ESC>
map H ^
map L $
let mapleader = "\<Space>" " Map leader to space
let g:mapleader = "\<Space>" " Map leader to space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment