Skip to content

Instantly share code, notes, and snippets.

@bryan-lott
Created November 5, 2014 22:31
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 bryan-lott/4f57e66aaa2a5cd69106 to your computer and use it in GitHub Desktop.
Save bryan-lott/4f57e66aaa2a5cd69106 to your computer and use it in GitHub Desktop.
VIM Config
if has('win32') || has('win64')
set runtimepath=$HOME/_vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/_vim/after
endif
" Usability & Appearance Options
filetype plugin indent on
syntax enable
" Turn on line numbering (turn off with "set nonu")
set nu
set relativenumber
" Wrap lines
set wrap
set linebreak
set showbreak=>\
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Other helpful switches
set showmode
set showcmd
set hidden
set ruler
set nocompatible
" Visual ruler at 80 characters
set colorcolumn=80
" Highlight searches
set hlsearch
set incsearch
set showmatch
" Fast editing of the .vimrc
map <leader>e :e! ~/_vimrc<cr>
" When vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/.vimrc
"-------------------------------------------------
" Indentation Options
set smarttab
set autoindent
"set si "Smart indent
set expandtab
set pastetoggle=<F12>
set backspace=indent,eol,start
"-------------------------------------------------
" Mapping
" Map Ctrl-C to copy to clipboard
map <C-c> "+y<CR>
" Map w!! to sudo save
cmap w!! w !sudo tee %
" Have <F5> show available buffers, hit a number to choose that buffer
:nnoremap <F5> :buffers<CR>:buffer<Space>
"------------------------------------------------
"Relative Line Numbers
"
" Create ctrl-n relative to absolute number toggling
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
nnoremap <C-n> :call NumberToggle()<cr>
" Automatically try to switch between relative/number
:au FocusLost * :set number
:au FocusGained * :set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
" Commenting this out until <ESC> gets to be a pain to use
" inoremap jj <ESC>
"
colorscheme solarized
" Set better split movement keys
nnoremap <leader>w <C-w>v<C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
set wildignore=*.pyc,*.bak,*.swp
set title
" <ESC> should turn off highlighting
nnoremap <ESC> :noh<return><ESC>
" Turn off the damn 'binging' all the time
set visualbell
set noerrorbells
" Set j/k movement per visual line instead of logical line
nnoremap j gj
nnoremap k gk
" source code pro in gVIM
"set anti enc=utf-8
"set guifont=Source\ Code\ Pro\ 11
set guifont=Consolas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment