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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
"" Basic Settings {{{{
""
set nocompatible " Use vim, no vi defaults
set number " Show line numbers
set numberwidth=5
set ruler " Show line and column number
set encoding=utf-8 " Set default encoding to UTF-8
set modelines=0 " do not check file for set commands
set scrolloff=3 " always show 3 lines above and below cursor
set gdefault " use global substitution by default
set showmatch " show matching bracket.
set showcmd " show last command in last line of screen.
set showmode " display mode in last line (e.g VISUAL)
set hidden " hide buffers instead of closing them.
set cursorline " highlight current line
set ttyfast " fast terminal connection
set visualbell " turn on visual bell
set t_vb= " set visual bell to do nothing
set noerrorbells " turn off error bell
set exrc " enable per-directory .vimrc files
set secure " disable unsafe commands in local .vimrc files
set nobackup " do not make backup files
set nowritebackup " do not write a backup
set splitright " open new splits to the right
set splitbelow " open new splits below
set autoread " auto load changed files
set title " the title of the window will be set to the value of titlestring
set clipboard^=unnamed,unnamedplus " use OS clipboard
set noswapfile
set autowrite
set tags=./.git/tags,./tmp/tags,./tags,tags,._tags
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set softtabstop=2 " number of spaces that a <Tab> counts for while performing editing
set shiftwidth=2 " an autoindent (with <<) is two spaces
set shiftround " When shifting lines, round the indentation to the
" nearest multiple of 'shiftwidth.'
set expandtab " use spaces, not tabs
set list " Show invisible characters
set backspace=indent,eol,start " backspace through everything in insert mode
set autoindent " copy indent from current line when starting a new one
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as copyright
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
" off and the line continues beyond the left of the screen
"set colorcolumn=80,100 " show color columns at 80 and 100
set nojoinspaces " Use one space, not two, after punctuation.
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set showmatch " briefly jump to the matching bracket.
runtime macros/matchit.vim
color happy_hacking
syntax enable " Turn on syntax highlighting allowing local overrides
set t_Co=256
" }}}}
"" Wild settings {{{{
""
set wildmenu
set wildmode=longest,list:longest
" Disable output and VCS files
set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem
" Disable archive files
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.zst
" Ignore bundler and sass cache
set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*
" Ignore rails temporary asset caches
set wildignore+=*/tmp/cache/assets/*/sprockets/*,*/tmp/cache/assets/*/sass/*
" Disable temp and backup files
set wildignore+=*.swp,*~,._*
" Ignore tmp folder, so files and coverage directory.
set wildignore+=*/tmp/*,*.so,*/coverage/*
" }}}}
"" Backup and swap files {{{{
""
" where to put backup files.
set backupdir=/tmp//
" where to put swap files.
set directory=/tmp//
" }}}}
"" File type-specific settings {{{{
""
filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin)
if has("autocmd")
au BufNewFile,BufRead *.hql set ft=hive expandtab
au BufNewFile,BufRead *.html set nowrap
au BufNewFile,BufRead *.json set ft=javascript
au BufNewFile,BufRead *.q set ft=hive expandtab
au BufRead,BufNewFile *.eco set ft=html
au BufRead,BufNewFile *.es6 set ft=javascript
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} set ft=markdown
au BufRead,BufNewFile {*.handlebars,*.hbs} set ft=handlebars syntax=handlebars
au BufRead,BufNewFile {Gemfile,Rakefile,RakeFile,Vagrantfile,Thorfile,Procfile,Guardfile,config.ru,*.rake} set ft=ruby
au FocusLost * :w
endif
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" }}}}
"
"" Command-Line Mappings {{{{
""
" After whitespace, insert the current directory into a command-line path
cnoremap <expr> <C-P> getcmdline()[getcmdpos()-2] ==# ' ' ? expand('%:p:h') : "\<C-P>"
" Kills Trailing Whitespaces
command! KillWhitespace :normal :%s/ *$//g<cr><c-o><cr>
" }}}
"" General Mappings (Normal, Visual, Operator-pending) {{{{
""
let mapleader = ","
let localleader = "\\"
" format the entire file
nnoremap <leader>fef :normal! gg=G``<CR>
" upper/lower word
nnoremap <leader>u mQviwU`Q
nnoremap <leader>l mQviwu`Q
" upper/lower first char of word
nnoremap <leader>U mQgewvU`Q
nnoremap <leader>L mQgewvu`Q
" cd to the directory containing the file in the buffer
nnoremap <silent> <leader>cd :lcd %:h<CR>
" Create the directory containing the file in the buffer
nnoremap <silent> <leader>md :!mkdir -p %:p:h<CR>
" Swap two words
nnoremap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
" Underline the current line with '='
nnoremap <silent> <leader>ul :t.<CR>Vr=
" set text wrapping toggles
nnoremap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
" find merge conflict markers
nnoremap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
" Map the arrow keys to be based on display lines, not physical lines
noremap <Down> gj
noremap <Up> gk
" Toggle hlsearch with <leader>hs
nnoremap <leader>hs :set hlsearch! hlsearch?<CR>
" Adjust viewports to the same size
noremap <leader>= <C-w>=
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader><space> :noh<cr>
nnoremap <tab> %
vnoremap <tab> %
nnoremap ; :
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
nnoremap <leader>v <C-w>v<C-w>l
nnoremap <leader>h <C-w>s<C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j<C-w>_
nnoremap <C-k> <C-w>k<C-w>_
nnoremap <C-l> <C-w>l
nnoremap <leader>p "+p
nnoremap <leader>n :NERDTreeFind<cr>
nnoremap <localleader>n :NERDTreeClose<cr>
" open fold
nnoremap <space> za
" create fold
vnoremap <space> zf
" surround with "
nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel
nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel
nnoremap H ^
nnoremap L $
inoremap jk <esc>
" NERDComToggleComment
nmap <localleader>/ <leader>c<space>
vmap <localleader>/ <leader>c<space>
nnoremap <leader>gs :Gstatus<cr>
nnoremap <leader>gb :Gblame -w -M<cr>
nnoremap / /\v
vnoremap / /\v
nnoremap <localleader>F :Ag<space>
nnoremap <localleader>f :Ack<space>
nnoremap <C-n> :GFiles<cr>
nnoremap <C-p> :Files<cr>
nnoremap <C-e> :Buffers<cr>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-l> <plug>(fzf-complete-line)
" }}}}
"" Status Line {{{{
""
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
set statusline=%f " path to the file
set statusline+=\ -\ " separator
set statusline+=%y " current file type
set statusline+=%= " switch to right side
set statusline+=[buffer:%02n] " current buffer
set statusline+=[column:%02v] " current column
set statusline+=[line:%04l " current line
set statusline+=/ " separator
set statusline+=%04L] " total lines
endif
" }}}}
"" Abbreviations {{{{
""
iabbrev adn and
iabbrev ohter other
iabbrev waht what
iabbrev teh the
iabbrev tehn then
iabbrev @@ mo@mokhan.ca
" }}}}
"" Plugin Configuration {{{{
""
let dart_format_on_save = 1
let dart_style_guide = 2
let g:vroom_map_keys = 0
let g:vroom_use_dispatch = 1
" }}}}
|