Skip to content

Instantly share code, notes, and snippets.

@fgr0
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save fgr0/a4bd1b4ad939dc990320 to your computer and use it in GitHub Desktop.

Select an option

Save fgr0/a4bd1b4ad939dc990320 to your computer and use it in GitHub Desktop.
Lightweight vim configuration
""" lightweight vimrc """
"" barebone options (explained) ""
set nocompatible
set nomodeline " Disable Modeline do to security implications
set hidden " Allow unsaved hidden buffers
set ruler " Show current cursor position
set showcmd " Show input for incomplete commands
set showmode " Show current Mode (Insert, Normal, Visual,...)
set wildmenu " Show completion-options for :-commands
set autoindent " Autoindent after a newline
set number " Show linenumbers
set hlsearch " Highlight search results
set ignorecase " Ignore Case when searching..
set smartcase " ..but not when using Capital Letters
set backspace=2 " Make Backspace behave like expected
set formatoptions=cqr " Automatic Text Formating for comments
set laststatus=2 " Always show statusline
set shortmess=at " Use short messages -- avoids scrolling
set textwidth=72 " Set the default width of text (after which for example comments are wrapped)
set whichwrap=<,>,h,l " Make some commands wrap around to the next line
set mouse=a " Enable the Mouse
set cmdheight=2 " Height of the command line, helps avoiding some prompts
set clipboard+=unnamed " Use system clipboard
" sets the statusline to something usefull (Buffer-Number, Filename, Fileflags, ..., Encoding, Format, Position,
set statusline=%-3.3n\ %<%.99f%m\ %h%w%r%y%=[%{strlen(&fenc)?&fenc:&enc},%{&fileformat}]%-16(\ %l,%c%V\ %)%P
"" basic environment settings ""
filetype plugin indent on " Enables Filetype recognition and plugins
syntax on " Enables Syntax Highlighting
set encoding=utf-8
if has('mouse')
set mouse=a
set mousemodel=popup_setpos
set mousehide
endif
"" basic ui settings ""
set more " Pause after each screen of output
set wrapscan " Search around the end-of-file (continue on top)
set gdefault " Substitute all matches in line by default
set virtualedit+=onemore,block " Allows for virtual editing of Selectionblocks and EOLs
set scrolloff=3
set sidescroll=1
set wrap
set linebreak
"" basic edit settings ""
set expandtab
set shiftwidth=4
set tabstop=4
set smarttab
set softtabstop=4
set copyindent
set showmatch " When inserting a closing bracket, jump briefly to opening bracket (if visible)
set matchtime=3 " Tens of seconds the openingbracket is shown
set matchpairs+=<:> " Adds < and > as matching brackets
"" basic keyboard mappings ""
let mapleader = ","
" Easier Move between Splits
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
map <C-H> <C-W>h
" Easier Movement between wraped lines
noremap j gj
noremap k gk
noremap 0 g0
noremap $ g$
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
nnoremap Y y$
" visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
""" lightweight vimrc """
"" barebone options ""
set nocp noml hid ru sc smd wmnu ai nu hls ic scs
set bs=2 fo=cqr ls=2 shm=at tw=72 ww=<,>,h,l mouse=a ch=2 cb+=unnamed
set statusline=%-3.3n\ %<%.99f%m\ %h%w%r%y%=[%{strlen(&fenc)?&fenc:&enc},%{&fileformat}]%-16(\ %l,%c%V\ %)%P
"" basic environment settings ""
filetype plugin indent on
syntax on
set enc=utf-8
if has('mouse')
set mouse=a mousemodel=popup_setpos mousehide
endif
"" basic ui settings ""
set more ws gd ve+=onemore,block so=3 ss=1 wrap lbr
"" basic edit settings ""
set et sw=4 ts=4 sta sts=4 ci sm mat=3 mps+=<:>
"" basic keyboard mappings ""
let mapleader = ","
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
map <C-H> <C-W>h
noremap j gj
noremap k gk
noremap 0 g0
noremap $ g$
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
nnoremap Y y$
vnoremap < <gv
vnoremap > >gv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment