dotfiles/vim/vimrc
2015-11-06 17:55:09 -05:00

109 lines
2.3 KiB
VimL

"#========================#"
"# vimrc file for niblock #"
"#========================#"
" Type :so % to refresh .vimrc after making changes
"######
"# Settings
"##
" https://stackoverflow.com/questions/5845557/in-a-vimrc-is-set-nocompatible-completely-useless
set nocompatible
" Auto-reload files changed outside Vim
set autoread
" Map Leader key
let mapleader = ","
" Shows you which commands you're typing
set showcmd
" Enables addons via Pathogen
" Add-ons go in ~/.vim/bundle/
" runtime bundle/vim-pathogen/autoload/pathogen.vim
" execute pathogen#infect()
" Load plugins with Vundle
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" Airline configuration
set laststatus=2
let g:airline_powerline_fonts = 1
" Necessary for Syntax hilighting
syntax on
filetype plugin indent on
" Enable line numbers, and make them relative
set number
set rnu
" Indendation modifications
" Auto indent; set spacing; use spaces
set autoindent
set expandtab
set smarttab
set shiftwidth=5
set softtabstop=5
" Spacing
" Set width; word wrap; scroll mods
set scrolloff=5
set tw=80
set colorcolumn=+1
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 incsearch
set hlsearch
" Set color scheme... duh...
colorscheme desert
"######
"# Mappings
"##
" Making moving up/down work on wrapped lines of text
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
" Toggle relative numbering
nnoremap <silent> <leader>n :set rnu!<CR>
" Easy-toggle nohlsearch
nnoremap <silent> <leader>h :set nohlsearch!<CR>
" Edit dotfiles with <leader>d
" v is for vim
nnoremap <silent> <leader>dv :tabnew ~/.vimrc<CR>
" b is for bash
nnoremap <silent> <leader>db :tabnew ~/.bashrc<CR>
" t is for tmux
nnoremap <silent> <leader>dt :tabnew ~/.tmux.conf<CR>
" d is for dotfiles install script
nnoremap <silent> <leader>dd :tabnew ~/.dotfiles/install.conf.yaml<CR>
" Remap ESC in insert mode
inoremap jk <esc>
" Toggle spell-check
nmap <silent> <leader>s :set spell!<CR>
" Remove Trailing Whitespaace
nnoremap <silent> <leader>rtw :%s/\s\+$//e<CR>