dotfiles/vim/vimrc
2016-11-21 12:26:01 -05:00

118 lines
2.6 KiB
VimL

"#========================#"
"# vimrc file for niblock #"
"#========================#"
" Type :so % to refresh .vimrc after making changes
"######
"# General Settings
"##
" Be IMproved ( Why? https://goo.gl/2RiJoo )
set nocompatible
" Necessary for Syntax hilighting and cool stuff
syntax on
filetype plugin indent on
set encoding=utf-8
" Auto-reload files changed outside Vim
set autoread
" Shows you which commands you're typing
set showcmd
" Enable line numbers
set number
" Indendation modifications
" Auto indent; set spacing; use spaces
set autoindent
set expandtab
set smarttab
set tabstop=4
set shiftwidth=4
set softtabstop=4
" File-Type Specifics
augroup customfiletypes
" Clear old autocmds in group
autocmd!
" Set auto-indent to two spaces, always expand tabs
autocmd FileType ruby,eruby,yaml set sw=2 sts=2
augroup END
" Spacing
" Set width; word wrap; scroll mods
set scrolloff=5
set textwidth=80
set winwidth=80
set wrap
" Enable auto-completion for vim commands
" :help wildmode and :help wildmenu for details
set wildmenu
set wildmode:longest:full,full
" Search modifications
" Incremental search; search hilighting
set ignorecase smartcase
set incsearch
set hlsearch
" Set default/backup colorscheme
colorscheme desert
"######
"# Mappings
"##
"
" I make use of many mappings from vim-impaired (hlsearch, relative numbering,
" and several other toggles). I highly suggest investing the time to learn and
" take advantage of those very eash mappings!
" Map Leader key
let mapleader = ","
" Make moving up/down work on wrapped lines of text
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
" Move between splits with CTRL+h/j/k/l
nnoremap <silent> <C-l> <C-w>l
nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-h> <C-w>h
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
" Remap ESC in insert mode
inoremap jk <esc>
" Remove Trailing Whitespaace
nnoremap <silent> <leader>rtw :%s/\s\+$//e<CR>
" Easy mapping for Startify
nnoremap <silent> <leader>s :Startify<CR>
" Open help topics in a full new tab
command! -nargs=1 -complete=help H :enew | :set buftype=help | :h <args>
" Show buffer list and prompt to choose one
nnoremap <leader>b :ls<CR>:b<space>
"######
"# Plugins
"###
" Old Way: Pathogen, add-ons go in ~/.vim/bundle/
" runtime bundle/vim-pathogen/autoload/pathogen.vim
" execute pathogen#infect()
" New Way: Vim-Plug, add-ons configured in .vimrc-plugins
if filereadable(expand("~/.vimrc-plugins"))
source ~/.vimrc-plugins
endif