-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
111 lines (85 loc) · 3.58 KB
/
.vimrc
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
" Do not force vi compatibility.
set nocompatible
" Allowing backspacing over anything while in insert mode.
set bs=2
" Always show the statusline below every window.
set laststatus=2
" Treat a hard-tab (ASCII byte #9) character in a file as a mod-8 indentation,
" but when autoindenting, indentation shifting, or pressing <Tab>, use mod-4
" indentation, and insert spaces instead of hard-tab characters.
set ts=8 sts=4 sw=4 expandtab smarttab
" Convenient indentation.
set autoindent smartindent
" Do not wrap lines of text.
set nowrap
" incremental searching. ignore case unless you type a capital letter,
" which makes the search case-sensitive
set ignorecase smartcase incsearch
" temporarily disable search highlighting when it gets annoying
nmap <silent> <leader>h :silent :nohlsearch<CR>
" Don't automatically resize windows when opening or closing them.
set noequalalways
" Change the titlebar to show the current file when running under a terminal.
set title
" Remap the 'Leader' key for things like opening NERDTree with ',n'
let mapleader = ','
" Let Vim take over when running in a terminal so that it's possible to move
" the cursor by clicking, resize split windows by dragging the divider, etc.
"set mouse=a
" Make it obvious where hard-tab characters (ASCII char #9) appear.
" Also show trailing whitespace.
set list
set listchars=tab:\│⋯,trail:·
"\|┈
"set listchars=tab:>-,trail:· "▶ × ✖ • ● ▄ ■ ▐ ░ ▒ ▓ ▞ ┅ ━ ◀ ▶ ⋀ ⊥ ⎵ ⎶ ➜ ╳
" do i really want to do this?
" automatically strip trailing whitespace when saving a file:
" autocmd BufWrite * %s/\s\+$//
" TODO: keyboard shortcut to strip trailing whitespaces on demand
autocmd BufRead *.c set cindent
autocmd BufRead *.cpp set cindent
autocmd BufRead *.cxx set cindent
autocmd BufRead *.txt set tw=76 wrap formatoptions+=n
autocmd BufNewFile,BufRead *.html set ft=htmldjango
autocmd BufNewFile,BufRead *.json set ft=typescript sw=2
autocmd BufNewFile,BufRead *.ts set ft=typescript sw=2
" Normally, I use four-space indentation, but the Ruby standard
" appears to be two spaces.
autocmd FileType ruby set sw=2 sts=2
autocmd FileType eruby set sw=2 sts=2
" Enable omnicomplete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
" If we're running under Vim version >= 7.3, highlight column 80 as the right
" margin.
if version >= 703
set colorcolumn=80
endif
" smartindent seems to have formatting leakage from cindent, because
" it forces lines beginning with '#' to column 0.
autocmd BufRead *.py set nocindent nosmartindent autoindent
" Tab-complete the way Bash does it.
set wildmode=longest,list
" Show line numbers in the buffer.
set nu
" Leave cursor in same column after page up/down.
set nostartofline
" Always show the line,column numbers in the statusline.
set ruler
" Show the beginning of multi-key commands below the status line:
set showcmd
" Always use syntax highlighting.
" If Vim is not highlighting the way you expect, you can try telling it
" explicitly what filetype to use. For example, to highlight a .json file,
" use :set filetype=javascript (or :set ft=javascript)
syntax on
" Keep all those pesky .swp files in one place.
set directory=~/.vimtmp,~/tmp,/var/tmp,/tmp
" Only use one space between sentences when joining lines or
" reformatting paragraphs.
set nojoinspaces
" Don't fold the whole file by default.
" It's annoying to open a source-code file and not see anything.
set foldlevel=20