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