Skip to content

Instantly share code, notes, and snippets.

@stungeye
Last active June 21, 2018 15:00
Show Gist options
  • Save stungeye/2388378f12faba5f4094 to your computer and use it in GitHub Desktop.
Save stungeye/2388378f12faba5f4094 to your computer and use it in GitHub Desktop.
.vimrc 2015
set nocompatible
autocmd!
filetype off
runtime! autoload/pathogen.vim
silent! call pathogen#infect()
silent! call pathogen#helptags()
filetype plugin indent on
scriptencoding utf-8
syntax enable
set t_Co=256
" Requires: https://raw.githubusercontent.com/Lokaltog/vim-distinguished/develop/colors/distinguished.vim
colorscheme distinguished
set encoding=utf-8
set virtualedit=onemore "Allow for cursor beyond last char
set mouse=a "Enable the mouse.
set nu "Show line numbers
set showmatch "Show matching parens/braces
set hlsearch "Highlight search terms
set incsearch "show search matches as you type
set ignorecase "Case insensitive search
set smartcase "Ignore case is search is all lower, otherwise don't.
set autoindent
set backspace=indent,eol,start
set shiftwidth=4
set expandtab
set tabstop=4
set softtabstop=4
set visualbell
set nowrap
" Changed <leader> from \ to ,
let mapleader=','
"$ moves after the last character
nnoremap $ $l
"Visual mode shifting (does not exit visual mode)
vnoremap < <gv
vnoremap > >gv
"clear highlighted search
nmap <silent> <leader>/ :nohlsearch<CR>
" Edit the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" Force me to use hjkl
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
"NerdTree
map <C-e> :NERDTreeToggle<CR>
nmap <leader>nt :NERDTreeFind<CR>
" Map a leader-f to a fuzzy finder
nnoremap <leader>f :CtrlP<CR>
autocmd FileType ruby,slim,sass setlocal tabstop=2 softtabstop=2 shiftwidth=2
" Detect trailing spaces
match ErrorMsg '\s\+$'
" Removes trailing spaces
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
nnoremap <silent> <Leader>tw :call TrimWhiteSpace()<CR>
" Then you can add on-write triggers that call that function. Again, in
" your .vimrc:
"
" autocmd FileWritePre * :call TrimWhiteSpace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment