-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
157 lines (107 loc) · 3.04 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
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
" ~/.vimrc
" Place local overrides in ~/.vim/plugin/local.vim
" ----- GENERAL SETTINGS -----
set nocompatible " use vim defaults
set encoding=utf-8
set modeline " allow modelines
set modelines=20 " check the first 20 lines in a file
set ttyfast
" allow backspacing over everything
set backspace=indent,eol,start
map! <BS>
" store files under ~/.vim/tmp/
set directory=~/.vim/tmp/
set backupdir=~/.vim/tmp/
"set undodir=~/.vim/tmp
"set undofile
set nobackup
" Load Vundle if present.
if filereadable($HOME . "/.vim/vundle.vim")
source $HOME/.vim/vundle.vim
endif
" ----- APPEARANCE -----
" enable syntax highlighting
syntax on
" set dark background color
set bg=dark
" some general settings
"set cursorline
set laststatus=2
set number
set ruler
set showmatch
set showmode
set showcmd
"set visualbell
" Automatically wrap lines at 100 characters.
set textwidth=100
" scroll when the cursor is within 5 lines of the edge of the window
set scrolloff=5
set sidescroll=10
" use rational split locations for new windows
set splitbelow
set splitright
" when comparing files, keep them synced and ignore whitespace
set diffopt=filler,iwhite
" configure code folding
"set foldcolumn=2 " set a column incase we need it
"set foldlevel=0 " show contents of all folds
"set foldmethod=indent " use indent unless overridden
" ----- INDENTATION -----
" autoindent new lines
set autoindent
" indent with four-space tabs by default
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" display full-width tabs when using list
set listchars=trail:~
set listchars+=tab:>-
set listchars+=eol:$
set listchars+=extends:>
set listchars+=precedes:<
"execute 'set listchars+=tab:' . nr2char(187) . nr2char(183)
set list
" ----- SEARCHING -----
" use perl regexes
"nnoremap / /\v
"vnoremap / /\v
" make all-lower-case searches case-insensitive
set ignorecase
set smartcase
" search defaults
set gdefault
set incsearch
set hlsearch
" ----- SHORTCUTS -----
" use comma as the leader key
let mapleader = ","
" quick shortcut to clear search highlights
nnoremap <leader><space> :noh<cr>
" convert tabs to spaces
nnoremap <leader>t :%s/\t/ /<cr>
nnoremap <leader>T :%s/\t/ /<cr>
" strip trailing whitespace from the file
nnoremap <leader>s :%s/\s\+$//<cr>
" add this to unhighlight things: :let @/=''<cr>
" select text which was just pasted
nnoremap <leader>v V`]
" reverse the highlighted lines
command! -bar -range=% Reverse <line1>,<line2>g/^/m<line1>-1|nohl
vnoremap <leader>r :Reverse<cr>
" use tab to jump to matching enclosure pairs
nnoremap <tab> %
vnoremap <tab> %
" ----- AUTOCOMPLETION -----
" allow autocompletion for commands and menus
set wildmode=longest,list,full
set wildmenu
" ignore VCS directories
set wildignore+=.git,.svn
" suffixes that get lower priority when doing tab completion for filenames
set suffixes=~,.bak,.swp,.o,.so,.ko,.class,.log
" ----- FILETYPE SETTINGS -----
filetype plugin indent on
" disable syntax error highlighting of C++ keywords in Java files
let java_allow_cpp_keywords = 1