-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_vimrc
49 lines (36 loc) · 1.24 KB
/
dot_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
" Load the defaults if vim version >= 8.0 and not Neovim
if v:version >= 800 && !has('nvim')
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
endif
set background=dark
" Smart case insensitive search
set ignorecase
set smartcase
" Search with incremental highlighting
set hlsearch
set incsearch
" Temporarily disable search highlights with <C-l>
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
" Use 4 spaces for indentation
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
" Don't break words when soft wrapping
set linebreak
" Supports copy & paste and scrolling on macOS
set mouse=a
" Add shortcuts for buffer navigation
nnoremap <silent> [b :bprevious<CR>
nnoremap <silent> ]b :bnext<CR>
nnoremap <silent> [B :bfirst<CR>
nnoremap <silent> ]B :blast<CR>
" Tab complete files relative to buffer (:edit %%<tab>)
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
" plugins
filetype plugin on
runtime macros/matchit.vim
" Help to write better git commit messages
" <https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message>
autocmd Filetype "gitcommit" setlocal spell textwidth=72
" And make sure the cursor is in first line when editing git commit messages
autocmd BufReadPost COMMIT_EDITMSG
\ exe "normal! gg"