" Fix for CSE servers scriptencoding utf-8 set encoding=utf-8 " Plugins set runtimepath+=~/.vim/bundle/vundle/ call vundle#rc() Bundle 'gmarik/vundle' Bundle 'airblade/vim-gitgutter' Bundle 'bronson/vim-trailing-whitespace' Bundle 'godlygeek/tabular' Bundle 'itchyny/lightline.vim' Bundle 'kien/ctrlp.vim' Bundle 'nathanaelkane/vim-indent-guides' Bundle 'rodjek/vim-puppet' Bundle 'tpope/vim-fugitive' Bundle 'tpope/vim-markdown' Bundle 'tpope/vim-rails' Bundle 'tpope/vim-repeat' Bundle 'tpope/vim-surround' " Options 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 set textwidth=80 set cpoptions+=$ " delimit end of change text set laststatus=2 " Always show status line set showmode " Show current mode set history=100 " History length set cursorline " Highlight current line set cursorcolumn " Highlight current column 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 set autoindent set colorcolumn=80 " Ruler at line 80 set nomodeline set relativenumber " Relative line numbers set number set noswapfile " Hope for the best set virtualedit=all " Cursor can go anywhere set scrolloff=3 " Keep cursor from touching edges " Make syntax highlighting faster syntax sync minlines=256 set ttyfast set lazyredraw " Tabs are 2 spaces set tabstop=2 set softtabstop=2 set shiftwidth=2 set expandtab " Show whitespace markers before cursor in insert mode set list listchars=tab:\ \ ,trail:ยท " Filetype stuff syntax on filetype on filetype plugin on filetype indent on " Keybinds " ctrl+s for save spam map :w imap :w " Still using arrow keys when in insert mode sometimes map map map map " Don't cancel visual mode while indenting vnoremap > >gv vnoremap < 2 :set tabstop=2 softtabstop=2 shiftwidth=2 expandtab map 4 :set tabstop=4 softtabstop=4 shiftwidth=4 expandtab map a :set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab " buffer movement map h :wincmd h map j :wincmd j map k :wincmd k map l :wincmd l " auto character alignment map t :Tabularize / map t> :Tabularize /=> map te :Tabularize /= " vundle map bi :BundleInstall map bu :BundleInstall! " copy and paste - for Linux map c "+ map p "+p map pm :set paste! " others " clear search - do not put this comment to the right of ,cs map cs :let @/ = "" map fw :FixWhitespace " indent and return map i mmgg=G`m map lf :call LargeFileToggle() " reload all buffers map ra :bufdo e! map s :e ~/Source/ map sa :call RenameFile() map se :e ~/.vimrc map st :call SyntaxToggle() map sz :so ~/.vimrc map ts :sp ~/tool-sharpener.txt " Set style set t_Co=256 colorscheme vividchalk " special case colors set at end of file via function " 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! set cursorcolumn! call SyntaxToggle() endfunction " Toggle syntax highlighting function! SyntaxToggle() if exists("g:syntax_on") :syntax off else syntax enable endif call SetColors() endfunction " 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 " Set special case colors function! SetColors() highlight CursorLine cterm=NONE ctermbg=234 highlight CursorColumn cterm=NONE ctermbg=234 highlight StatusLine ctermfg=white ctermbg=236 highlight SignColumn ctermbg=black highlight ColorColumn ctermbg=234 highlight IndentGuidesOdd ctermbg=black highlight IndentGuidesEven ctermbg=234 highlight OverLength ctermbg=darkred ctermfg=white guibg=#FFD9D9 endfunction " Needs to come after SetColors definition call SetColors() match OverLength /\%81v.*/