]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - vimrc
Restructured vimrc and added section names.
[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 set spell
59 set spelllang=en_us
60
61
62 " DISPLAY SETTINGS
63
64 " Use a dark background.
65 set background=dark
66
67 " Activate lines display.
68 set number
69 " Display the ruler with current line/file position.
70 set ruler
71 " Display partial commands in the status line.
72 set showcmd
73
74 " Visualize the line the cursor is currently in.
75 set cursorline
76
77 " Display tabs as "^I" and trailing space as "-".
78 set list
79 set listchars=trail:-
80
81
82 " EDITOR SETTINGS
83
84 " Don't use any modelines.
85 set nomodeline
86
87 " When completing paths first use the longest path then display a list of all
88 " possible files.
89 set wildmode=longest,list
90
91
92 " MAPPINGS
93
94 " Use "," as my mapleader.
95 let mapleader = ","
96 let maplocalleader = ","
97
98 " Settings for the NERD commenter.
99 " Don't create any mappings I don't want to use.
100 let NERDCreateDefaultMappings=0
101 " Map toggle comment.
102 map <Leader><Leader> <plug>NERDCommenterToggle
103
104 " Maps to change spell language between English and German.
105 map <Leader>se :set spelllang=en_us<CR>
106 map <Leader>sd :set spelllang=de_de<CR>
107
108 " I often type "W" instead of "w" when trying to save a file. Fix my mistake.
109 cmap W w
110 cmap Wq wq
111 " Also fix my typo with "Q".
112 cmap Q q
113
114 " Disable Apple style movements in MacVim.
115 if has("gui_macvim")
116     let macvim_skip_cmd_opt_movement = 1
117 endif
118
119
120 " SYNTAX SETTINGS
121
122 " Activate syntax coloring.
123 syntax enable
124
125
126 " Automatically save and the load the file state (stored in ~/.vim/view).
127 autocmd BufWrite * mkview
128 autocmd BufRead  * loadview