]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - vimrc
Be Vim 6 compatible.
[config/dotfiles.git] / vimrc
1 " Vim main configuration file.
2
3
4 " Make sure Vim (and not Vi) settings are enabled.
5 set nocompatible
6
7
8 " EDIT SETTINGS
9
10 " Enable automatic file detection, plugin and indention.
11 filetype plugin indent on
12
13 " Use UTF-8 file encoding for all files.
14 set fileencodings=utf-8
15
16 " Wrap text after 78 characters.
17 set textwidth=78
18
19 " Set tabs to 4 spaces, use softtabs.
20 set shiftwidth=4
21 set softtabstop=4
22 set expandtab
23 " When < and > is used indent/deindent to the next shiftwidth boundary.
24 set shiftround
25 " Use the default value for real tabs.
26 set tabstop=8
27
28 " Enable auto indention.
29 set autoindent
30
31 " When joining lines only add one space after a sentence.
32 set nojoinspaces
33
34 " Allow backspacing over autoindent, line breaks and insert mode starts.
35 set backspace=indent,eol,start
36
37 " Start a comment when hitting enter after a commented line (r) and when using
38 " o or O around a commented line (o).
39 set formatoptions+=ro
40 " Don't break a line if was already longer then 'textwidth' when insert mode
41 " started.
42 set formatoptions+=l
43
44 " Already display matches while typing the search command. This makes spotting
45 " errors easily.
46 set incsearch
47
48 " Activate syntax folding.
49 set foldmethod=syntax
50 set foldcolumn=2
51 set foldlevel=99 " no folding at default
52
53 " Only check for case if the searched word contains a capital character.
54 set ignorecase
55 set smartcase
56
57 " Activate spell checking, use English as default.
58 if v:version >= 700
59     set spell
60     set spelllang=en_us
61 endif
62
63
64 " DISPLAY SETTINGS
65
66 " Use a dark background.
67 set background=dark
68
69 " Activate lines display.
70 set number
71 " Display the ruler with current line/file position.
72 set ruler
73 " Display partial commands in the status line.
74 set showcmd
75
76 " Visualize the line the cursor is currently in.
77 if v:version >= 700
78     set cursorline
79 endif
80
81 " Display tabs as "^I" and trailing space as "-".
82 set list
83 set listchars=trail:-
84
85
86 " EDITOR SETTINGS
87
88 " Don't use any modelines.
89 set nomodeline
90
91 " When completing paths first use the longest path then display a list of all
92 " possible files.
93 set wildmode=longest,list
94
95
96 " MAPPINGS
97
98 " Use "," as my mapleader.
99 let mapleader = ","
100 let maplocalleader = ","
101
102 " Settings for the NERD commenter.
103 " Don't create any mappings I don't want to use.
104 let NERDCreateDefaultMappings=0
105 " Map toggle comment.
106 map <Leader><Leader> <plug>NERDCommenterToggle
107
108 " Maps to change spell language between English and German.
109 map <Leader>se :set spelllang=en_us<CR>
110 map <Leader>sd :set spelllang=de_de<CR>
111
112 " I often type "W" instead of "w" when trying to save a file. Fix my mistake.
113 cmap W w
114 cmap Wq wq
115 " Also fix my typo with "Q".
116 cmap Q q
117
118 " Disable Apple style movements in MacVim.
119 if has("gui_macvim")
120     let macvim_skip_cmd_opt_movement = 1
121 endif
122
123
124 " SYNTAX SETTINGS
125
126 " Activate syntax coloring.
127 syntax enable
128
129
130 " Automatically save and the load the file state (stored in ~/.vim/view).
131 autocmd BufWrite * mkview
132 autocmd BufRead  * loadview