Add gcc alias to work around MacOS stupidity
[dotfiles] / .vimrc
1 " Don't imitate vi.
2 set nocompatible
3
4 " Make tab-completion work more like bash.
5 set wildmenu
6 set wildmode=list:full
7
8 " Ignore certain file extensions when tab-completing.
9 set wildignore=*.swp,*.bak,*.pyc,*.class,*.o,*.exe
10
11 " Set filetype stuff to on.
12 filetype on
13 filetype plugin on
14
15 " Set up autoindentation.
16 set smartindent
17 filetype indent on
18
19 " Example filetype-specific setting:
20 " if has('autocmd')
21 "     autocmd filetype python set expandtab
22 " endif
23
24 " Allow folding.
25 set foldenable
26 set foldmethod=syntax
27 set foldlevelstart=99
28
29 " Scroll five lines ahead of cursor.
30 set scrolloff=5
31
32 " Turn off error bells and visual bell
33 set noeb vb t_vb=
34
35 " Set tabs to width 2.
36 filetype plugin indent on
37 set shiftwidth=2
38 set softtabstop=2
39 set tabstop=2
40 set expandtab
41
42 " language-specific settings: tab width is 4 for python
43 autocmd FileType python setlocal shiftwidth=4 softtabstop=4 tabstop=4
44
45 "allow projet-specific vimrcs
46 set exrc
47 set secure " Don't execute :autocmd in project-specific vimrcs unless owned by me
48
49 " Allow backspacing over everything in insert mode.
50 set backspace=indent,eol,start
51
52 "Highlight bad spacing.
53 highlight BadSpacing term=standout ctermbg=cyan
54 augroup Spacing
55     autocmd!
56     " Highlight tabulators and trailing spaces
57     autocmd BufNewFile,BufReadPre * match BadSpacing /\(\t\|  *$\)/
58     " Only highlight trailing space in tab-filled formats
59     autocmd FileType help,make match BadSpacing /  *$/
60 augroup END
61
62 " Search as you type.
63 set incsearch
64
65 " Display command and location status.
66 set ruler
67 set showcmd
68
69 " Multiple windows are equally sized and open in reading order.
70 set equalalways
71 set splitbelow splitright
72
73 " Line wrapping off
74 set nowrap
75
76 " Enlarge history and undo/redo buffers.
77 set history=1000
78 set undolevels=1000
79
80 " Reset colors to a clean state.
81 if !has('gui_running')
82     set t_Co=8 t_md=
83 endif
84
85 " Enable syntax highlighting.
86 syntax enable
87
88 " Force vim to sync syntax highlighting from the beginning of the file.
89 syn sync fromstart
90
91 " Set the color scheme to desert.
92 colorscheme desert
93
94 " Set custom whitespace display
95 set list
96 set showbreak=↪\ 
97 set listchars=tab:\ \ →,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨
98
99 " Unmap the arrow keys to prevent bad habits.
100 noremap  <Up> ""
101 noremap! <Up> <Esc>
102 noremap  <Down> ""
103 noremap! <Down> <Esc>
104 noremap  <Left> ""
105 noremap! <Left> <Esc>
106 noremap  <Right> ""
107 noremap! <Right> <Esc>
108
109 " Automatically reload the .vimrc when changes are made to it
110 au! BufWritePost .vimrc source %