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