-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimextra
157 lines (119 loc) · 4.18 KB
/
vimextra
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
" Vim not vi.
set nocompatible
" Show syntax highlighting.
syntax enable
" Use filetype-specific indentation, via $DIR/indent/$FILETYPE.vim
"filetype plugin indent on
" Use smartindent.
set smartindent
" Show line numbers.
set number
" Choose syntax colors that work well on a light background.
set bg=light
" Allow backspacing over anything.
set backspace=indent,eol,start
" Case-insensitive regexes.
set ignorecase
" Wrap long lines.
set wrap
" <tab> autocompletion of directories.
set wildchar=<tab>
" Highlight matches after a search.
set hlsearch
" Incremental search -- start as soon as the first character is typed.
set incsearch
" Highlight matching brackets as the cursor passes over them.
set showmatch
" Always show the status bar at the bottom of the screen.
set laststatus=2
" Show line, column, %-complete stats in status bar.
set ruler
" Set the font used by gvim (Mac OS X only);
set guifont=Menlo:h13
" Recognize .rs as Rust.
autocmd BufNewFile,BufRead *.rs set filetype=rust
" Automatically recognize .pm, .plx, .t files as perl
autocmd BufNewFile,BufRead *.plx set filetype=perl
autocmd BufNewFile,BufRead *.pm set filetype=perl
autocmd BufNewFile,BufRead *.t set filetype=perl
" Recognize .mdtext, .md, .mdown as Markdown.
autocmd BufNewFile,BufRead *.mdtext set filetype=markdown
autocmd BufNewFile,BufRead *.md set filetype=markdown
autocmd BufNewFile,BufRead *.mdown set filetype=markdown
" Recognize .cfh as Clownfish
autocmd BufNewFile,BufRead *.cfh set filetype=clownfish
" Recognize .go as Go.
autocmd BufNewFile,BufRead *.go set filetype=go
" Use "visual bell" instead of the annoying "audio blink".
set vb
" Make the backspace key behave the same across different terminals.
set t_kb=ctrl-vBACKSPACE
" Set t_kD (the delete key) to the value of t_kb so that delete and backspace
" work the same.
if !has('nvim')
fixdel
endif
" Allow cursor keys plus h, l to wrap when used at the beginning or end of a line.
" <> are cursor keys in normal and visual mode.
" [] are cursor keys in insert mode.
set whichwrap=b,s,<,>,[,],h,l
" Make backspace treat 4 spaces as a tab.
set softtabstop=4
" Have <tab> key type spaces.
set expandtab
" Disable expandtab for Makefiles and Go files.
autocmd FileType make setlocal noexpandtab
autocmd FileType go setlocal noexpandtab
" Display tabs as four spaces
set tabstop=4
" Have automatic indentation work like tabs.
set shiftwidth=4
" Wrap lines at 78 characters.
set textwidth=78
" Set GUI window width to the textwidth plus 4 to accommodate line numbers.
if has("gui_running")
set columns=82
endif
" Use a narrower width for commit messages so that `git log` looks good.
autocmd FileType gitcommit,svn setlocal textwidth=72
" Use 2-space indent for HTML, XML, SVG, CSS, JavaScript, Java, Ruby.
autocmd FileType html,xml,svg,css,javascript,java,ruby setlocal shiftwidth=2
autocmd FileType html,xml,svg,css,javascript,java,ruby setlocal softtabstop=2
autocmd FileType html,xml,svg,css,javascript,java,ruby setlocal tabstop=2
" Default to UTF-8.
set encoding=utf-8
" Remap movement keys to a more ergonomic 'inverted-T' configuration. Then
" set `e` and `E` to enter insertion mode (think 'edit') since `i` has been
" used for movement.
noremap i <Up>
noremap j <Left>
noremap k <Down>
noremap l <Right>
noremap e <insert>
noremap E ^<insert>
noremap h b
noremap ; w
" Make carat easier to type.
inoremap <C-a> ^
" Remove the touchbar menu, especially the full-page key which I always hit
" accidentally because it's next to the <ESCAPE> key.
let g:macvim_default_touchbar_fullscreen=0
if has("gui_macvim")
" Remove Vim buttons from the Touch Bar.
aunmenu TouchBar.
endif
" Allow for per-repository vimrc files.
"
" If we're in a git repository, AND there is a file named `.marvimrc` in
" the root directory of the repository, AND that file is not committed,
" then it must be a vimrc file that I put there and it's safe to load.
let git_path = system("git rev-parse --show-toplevel 2>/dev/null")
if !empty(git_path)
let marvimrc = substitute(git_path, '\n', '', '') . "/.marvimrc"
if !empty(glob(marvimrc))
let marvimrc_log = system("git log " . marvimrc)
if empty(marvimrc_log)
exec ":source " . marvimrc
endif
endif
endif