Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
200 lines (172 sloc) 5.71 KB
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pathogen
" https://github.com/tpope/vim-pathogen
"
" Bundles
" Fugitive
" https://github.com/tpope/vim-fugitive
" Taglist
" https://github.com/vim-scripts/taglist.vim
" Perl Critic Vim Compiler -
" https://github.com/vim-scripts/perlcritic-compiler-script
" javaScriptLint.vim
" https://github.com/joestelmach/javaScriptLint.vim
"
" Bundle Dependencies
" Taglist - exuberant ctags
" Enable Pathogen
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable loading plugin files for specific file types
filetype plugin on
filetype indent on
" Enable the mouse
set mouse-=a
" Allow backspacing over autoindent, line breaks, start of insert
set backspace=2
" Disable backups, useful for read-only media and limited space
set nobackup
" Substitute all matches on a line by default
set gdefault
" Turn on short messages
set shortmess="aoI"
" Disable history
set viminfo=""
" Enable autowrite
set autowrite
" Disable autowrite for extra commands
set noautowriteall
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Formatting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim default format options, just in case
set formatoptions=tcq
" Automatic c code indenting
set cindent
" Fix for vim outdenting comments to column 1
" from http://thenobot.org/stories/?i=117
set cinkeys=0{,0},!^F,o,O,e " default is: 0{,0},0),:,0#,!^F,o,O,e
" Automatically indent
set autoindent
" Make inserting and removing tabs easier
set smarttab
" Replace tabs with spaces
set expandtab
" Number of characters limited to a line
set textwidth=77
" Each auto-indent step is this many spaces
set shiftwidth=4
" Number of spaces in a tab
set tabstop=4
" Round indent to multiple of shiftwidth
set shiftround
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Searching
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Searches wrap around the end of the file
set wrapscan
" Disable search results highlighting
set nohlsearch
" While typing a search command, show where the pattern, as it was typed so
" far, matches.
set noincsearch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Visual display
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Virtually wrap long lines
set wrap
" Show line numbers
set number
" Show current line number and horizontal position
set ruler
" Add $ to cpoptions, when changing a line put '$' at the end of the line,
" changed text is overwritten
" Also add to ~/vim/after/ftplugin/taglist.vim because taglist.vim resets this
" to the default settings
set cpoptions+=$
" Turn on syntax folding
set foldmethod=syntax
" Set highlighting of folded areas to a darker color
"hi Folded ctermfg=2 ctermbg=0
" Prevent showing __Tag_List__ as title, only in screen (or tmux) otherwise
" the display gets corrupted
if !exists("title_set") && &term == "screen"
let title_set = 1
" Show the current working directory on exit in the title
let &titleold=""
" Show title in tmux window name
set t_ts=k
set t_fs=\
let &titlestring = "vim " . expand("%")
set title
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Syntax highlighting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn on syntax highlighting
syntax on
" Default blue for comments is too dark on dark background terminals
"hi comment ctermfg=blue
set background=dark
colorscheme solarized
" Highlight parts of the line that are longer than 78 characters
hi OverLength ctermbg=darkred ctermfg=white
match OverLength /\%79v.\+/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General key mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = ","
" map f !Gperl -MText::Autoformat -e'autoformat {squeeze=>0}'
" Format text
map f {!}fmt -79
" Page forward
map <space> <c-f>
" Page backward
map <backspace> <c-b>
" Re-read your .vimrc
nmap <leader>s :source ~/.vimrc<cr>
" Edit your .vimrc
nmap <leader>v :e ~/.vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TagList
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Exit if TagList is the only window left
let Tlist_Exit_OnlyWindow = 1
" Auto close the fold for inactive files
let Tlist_File_Fold_Auto_Close = 1
" Only show the current file in TagList
"let Tlist_Show_One_File = 1
" Show the TagList on the right
let Tlist_Use_Right_Window = 1
if winwidth(0) >= 160
" Auto open TagList on supported files
let Tlist_Auto_Open = 1
let Tlist_WinWidth = 40
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File formats
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
augroup FileFormats
autocmd!
" Google Gadgets XML
au BufRead <google_gadgets> runtime! syntax/google_gadgets.vim
" .ebnf format
au BufEnter *.ebnf runtime! bundle/ebnf.vim/syntax/ebnf.vim
" .otl Outline
au BufEnter *.otl set filetype=outline
" Makefiles
au BufEnter [Mm]ake* set filetype=make
augroup END " FileFormats
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text files
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
augroup TextFiles
autocmd!
" Turn off colors
autocmd BufEnter *.txt syntax off
" Check spelling
autocmd BufEnter *.txt,*.html,README set spell
augroup END " TextFiles
You can’t perform that action at this time.