-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
205 lines (181 loc) · 6.09 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
" Check if this is probably vim-tiny
if has('eval')
" Set up persistent undo across all files.
set undofile
if !isdirectory(expand("$HOME/.vim/undodir"))
call mkdir(expand("$HOME/.vim/undodir"), "p")
endif
set undodir=$HOME/.vim/undodir
set updatetime=100
" Turn on syntax highlighting
"syntax on
syntax enable
" Enable filetype plugins
"filetype plugin indent on
" Set to auto read when a file is changed from the outside
" I think this tends to give false alarms or something, though.
set autoread
" filename completion for multiple files
set wildmenu
set wildmode=list:longest
" With a map leader it's possible to do extra key combinations
let mapleader = " "
let g:mapleader = " "
" Base utility mappings
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" surround word cursor is on in double quotes
nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
" surround word cursor is on in single quotes
nnoremap <leader>' viw<esc>a'<esc>bi'<esc>lel
" surround visually selected block in double quotes
vnoremap <leader>v" <esc>`>a"<esc>`<i"<esc>lel
" surround visually selected block in single quotes
vnoremap <leader>v' <esc>`>a'<esc>`<i'<esc>lel
" help my common typos
iabbrev adn and
iabbrev teh the
iabbrev taht that
iabbrev endopint endpoint
iabbrev chanegs changes
iabbrev updaet update
" :W sudo saves the file
" (useful for handling the permission-denied error)
command! W w !sudo tee % > /dev/null
set swapfile
if !isdirectory(expand("$HOME/.vim/swap"))
call mkdir(expand("$HOME/.vim/swap"), "p")
endif
set directory=$HOME/.vim/swap//
endif
"Always show current position
set ruler
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
set modeline modelines=5 " use settings from file being edited
set writebackup
" yes, I hate highlight search
set nohlsearch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs, as the Lord intended.
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
set softtabstop=2
set ai "Auto indent
set si "Smart indent
" I'm not a fan of folding in general so I disable it.
set foldcolumn=0
set nofoldenable
set guifont=Monaco:h14
if has('termguicolors')
set termguicolors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
set background=dark
" set t_Co=256
"option name default optional
"------------------------------------------------
"g:solarized_termcolors= 16 | 256
"g:solarized_termtrans = 0 | 1
"g:solarized_degrade = 0 | 1
"g:solarized_bold = 1 | 0
"g:solarized_underline = 1 | 0
"g:solarized_italic = 1 | 0
"g:solarized_contrast = "normal"| "high" or "low"
"g:solarized_visibility= "normal"| "high" or "low"
"------------------------------------------------
"g:solarized_termcolors= 16 | 256
" show me where my cursor is
set cursorline cursorcolumn
" caSe MaTtERs, people!
set noignorecase
set nosmartcase
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" Always show the status line
set laststatus=2
if has('eval')
" Format the status line
"set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
"
" Move a line of text using ALT+[jk] or Comamnd+[jk] on mac
"nmap <M-j> mz:m+<cr>`z
"nmap <M-k> mz:m-2<cr>`z
"vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
"vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
"if has("mac") || has("macunix")
"nmap <D-j> <M-j>
"nmap <D-k> <M-k>
"vmap <D-j> <M-j>
"vmap <D-k> <M-k>
"endif
map <leader>pp :setlocal paste!<cr>
"
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
" spelling
" turn off vim builtin spelling, cuz we using spelunker
set nospell
" Enable spelunker.vim. (default: 1)
" 1: enable
" 0: disable
let g:enable_spelunker_vim = 0
" Enable spelunker.vim on readonly files or buffer. (default: 0)
" 1: enable
" 0: disable
let g:enable_spelunker_vim_on_readonly = 0
" Check spelling for words longer than set characters. (default: 4)
let g:spelunker_target_min_char_len = 4
" Max amount of word suggestions. (default: 15)
let g:spelunker_max_suggest_words = 15
" Max amount of highlighted words in buffer. (default: 100)
let g:spelunker_max_hi_words_each_buf = 100
" Spellcheck type: (default: 1)
" 1: File is checked for spelling mistakes when opening and saving. This
" may take a bit of time on large files.
" 2: Spellcheck displayed words in buffer. Fast and dynamic. The waiting time
" depends on the setting of CursorHold `set updatetime=1000`.
let g:spelunker_check_type = 2
" Option to disable word checking.
" Disable URI checking. (default: 0)
let g:spelunker_disable_uri_checking = 1
" Disable email-like words checking. (default: 0)
let g:spelunker_disable_email_checking = 1
" Disable account name checking, e.g. @foobar, foobar@. (default: 0)
" NOTE: Spell checking is also disabled for JAVA annotations.
let g:spelunker_disable_account_name_checking = 1
" Disable acronym checking. (default: 0)
let g:spelunker_disable_acronym_checking = 1
" Disable checking words in backtick/backquote. (default: 0)
let g:spelunker_disable_backquoted_checking = 1
" Disable default autogroup. (default: 0)
let g:spelunker_disable_auto_group = 0
" Override highlight setting.
" highlight SpelunkerSpellBad cterm=underline ctermfg=247 gui=underline guifg=#9e9e9e
" highlight SpelunkerComplexOrCompoundWord cterm=underline ctermfg=NONE gui=underline guifg=NONE
let g:spelunker_white_list_for_user = ['kamykn', 'vimrc', 'keisler', 'syntastic', 'solarized', 'powerline', 'shfmt']
endif