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