dotfiles/.vimrc

150 lines
4.2 KiB
VimL
Raw Normal View History

2013-09-05 11:49:24 -04:00
" Fix for CSE servers
scriptencoding utf-8
set encoding=utf-8
2013-04-29 15:29:20 -04:00
" Plugins
set runtimepath+=~/.vim/bundle/vundle/
2013-04-29 15:29:20 -04:00
call vundle#rc()
Bundle 'gmarik/vundle'
2013-04-29 16:33:34 -04:00
Bundle 'airblade/vim-gitgutter'
2013-08-06 04:13:10 -04:00
Bundle 'bronson/vim-trailing-whitespace'
2013-05-29 11:21:37 -04:00
Bundle 'godlygeek/tabular'
2013-08-27 11:58:06 -04:00
Bundle 'itchyny/lightline.vim'
2013-04-29 16:33:34 -04:00
Bundle 'kien/ctrlp.vim'
2013-07-19 01:39:58 -04:00
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'rodjek/vim-puppet'
2013-08-27 11:55:55 -04:00
Bundle 'tpope/vim-fugitive'
2013-04-29 15:29:20 -04:00
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'vim-scripts/ruby-matchit'
2013-04-29 02:31:18 -04:00
" Options
2013-07-20 00:08:00 -04:00
set nocompatible " Disable vi compatibility
set fileformats=unix,dos " File format prefer unix endings
set endofline " Add newlien at end of file
set shellslash " Forward slashes
set nobackup " No backup files
set formatoptions=crq
2013-04-29 02:31:18 -04:00
set textwidth=80
set cpoptions+=$ " delimit end of change text
2013-07-20 00:08:00 -04:00
set laststatus=2 " Always show status line
set showmode " Show current mode
set history=100 " History length
set cursorline " Highlight current line
2013-07-24 23:06:54 -04:00
set cursorcolumn " Highlight current column
2013-07-20 00:08:00 -04:00
set nowrap " Disable wrapping by default
set backspace=2 " Backspace over indent, eol, start of insert
set hlsearch " Search highlights
set wrapscan " Wraped search
set incsearch " Search as yuo type
set ignorecase " Ignore case with search
set smartcase " Search will not ignore uppercase
set showcmd " Show command as you type
set ruler " Show cursor position
2013-04-29 02:31:18 -04:00
set autoindent
2013-07-20 00:08:00 -04:00
set colorcolumn=80 " Ruler at line 80
set nomodeline
2013-07-20 00:08:00 -04:00
set relativenumber " Relative line numbers
set number
2013-07-20 00:08:00 -04:00
set noswapfile " Hope for the best
2013-08-12 02:18:47 -04:00
set virtualedit=all " Cursor can go anywhere
set scrolloff=3 " Keep cursor from touching edges
2013-04-29 02:31:18 -04:00
" Tabs are 2 spaces
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
2013-08-05 21:38:24 -04:00
" Show whitespace markers before cursor in insert mode
set list listchars=tab:\ \ ,trail
2013-04-29 13:32:51 -04:00
" Filetype stuff
2013-04-29 15:29:20 -04:00
syntax on
2013-04-29 13:32:51 -04:00
filetype on
filetype plugin on
filetype indent on
" Keybinds
" ctrl+s for save spam
map <C-s> <esc>:w<CR>
imap <C-s> <esc>:w<CR>
2013-08-05 22:07:01 -04:00
" Still using arrow keys when in insert mode sometimes
map <Left> <Nop>
map <Right> <Nop>
map <Up> <Nop>
map <Down> <Nop>
2013-04-29 13:32:51 -04:00
" Leaders (whatever that means)
let mapleader = ","
2013-07-19 01:39:58 -04:00
map <Leader>bi :BundleInstall<cr>
2013-09-18 21:08:28 -04:00
map <Leader>bu :BundleInstall!<cr>
2013-08-08 14:07:23 -04:00
map <Leader>c "+
2013-08-06 04:13:10 -04:00
map <Leader>fw :FixWhitespace<cr>
map <Leader>i mmgg=G`m<cr>
map <Leader>lf :call LargeFileToggle()<cr>
2013-08-08 14:07:23 -04:00
map <Leader>p "+p
2013-09-18 21:08:28 -04:00
map <Leader>pm :set paste!<cr>
2013-07-19 01:39:58 -04:00
map <Leader>s :e ~/Source/<cr>
2013-08-05 22:07:01 -04:00
map <Leader>sa :call RenameFile()<cr>
2013-07-19 01:39:58 -04:00
map <Leader>se :e ~/.vimrc<cr>
map <Leader>sz :so ~/.vimrc<cr>
2013-05-29 11:21:37 -04:00
map <Leader>t :Tabularize /
2013-09-18 21:08:28 -04:00
map <Leader>t> :Tabularize /=><cr>
map <Leader>te :Tabularize /=<cr>
map <Leader>ts :sp ~/tool-sharpener.txt<cr>
2013-04-29 13:32:51 -04:00
" Set style
2013-08-05 22:07:01 -04:00
set t_Co=256
2013-04-29 13:32:51 -04:00
set guifont=Ubuntu\ Mono\ 10
colorscheme vividchalk
hi CursorLine cterm=NONE ctermbg=234
2013-07-24 23:06:54 -04:00
hi CursorColumn cterm=NONE ctermbg=234
2013-07-19 18:32:01 -04:00
hi StatusLine ctermfg=white ctermbg=236
2013-04-29 17:45:36 -04:00
hi SignColumn ctermbg=black
hi ColorColumn ctermbg=234
2013-07-19 18:32:01 -04:00
hi IndentGuidesOdd ctermbg=black
hi IndentGuidesEven ctermbg=234
2013-08-27 11:55:55 -04:00
" Indentation
let g:indent_guides_guide_size=1
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_auto_colors=0
" lightline
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'filename' ] ]
\ },
\ 'component': {
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ },
\ 'component_visible_condition': {
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ }
\ }
" Functions
" Toggle relative line numbers and cursorline; useful for long line files
function! LargeFileToggle()
set relativenumber!
set cursorline!
2013-07-24 23:06:54 -04:00
set cursorcolumn!
endfunction
2013-08-05 22:07:01 -04:00
" Rename current file - from github/garybernhardt
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
endif
endfunction