dotfiles/vim/vimrc
Bill Niblock 20a0e408a6 Fidgeting
2016-08-27 15:23:06 -04:00

119 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
" Auto-reload files changed outside Vim
set autoread
" Shows you which commands you're typing
set showcmd
" 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=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 incsearch
set hlsearch
" Set default/backup colorscheme
colorscheme desert
"######
"# 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
"######
"# 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$
" Shift between tabs with Shift+h/l
nnoremap <silent> <S-l> gt
nnoremap <silent> <S-h> gT
" 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 %
" 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 ~/.dotfiles/vim/vimrc<CR>
nnoremap <silent> <leader>dp :tabnew ~/.dotfiles/vim/vimrc-plugins<CR>
" b is for bash
" nnoremap <silent> <leader>db :tabnew ~/.dotfiles/bash/bashrc<CR>
" t is for tmux
nnoremap <silent> <leader>dt :tabnew ~/.dotfiles/tmux/tmux.conf<CR>
" m is for makefile
nnoremap <silent> <leader>dm :tabnew ~/.dotfiles/makefile<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>