-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
77 lines (70 loc) · 2.4 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
" include default settings
source $VIMRUNTIME/defaults.vim
" press K on an option for help
set autoindent
set autoread
set hlsearch
set smarttab
set scrolloff&
set wildignorecase " case insensitive filename completion
set infercase " and insert mode completion
set ignorecase " and search
set smartcase " unless search contains a capital letter
set display=lastline
set listchars=tab:>\ ,trail:-,nbsp:+
set wildoptions=pum,tagfile
set wildcharm=<Tab> " let tab start wildmenu in mappings
set formatoptions+=j " delete comment characters when joining comment lines
set colorcolumn=+0 " show colorcolumn at textwidth
set errorformat+=%m\ %f " for git status :cexpr
set grepprg=git\ grep\ -I\ -n\ --column
set grepformat=%f:%l:%c:%m
let &path = systemlist("git ls-tree -rd --name-only HEAD")
\->join(",").",,"
" make capital Y behave like capital C and D (use yy to yank whole line)
nnoremap Y y$
" make * and # work on visual selection
vnoremap * y/\V<C-R>=substitute(escape(@",'/\'), '\n', '\\n', 'g')<CR><CR>
vnoremap # y/\V<C-R>=substitute(escape(@",'/\'), '\n', '\\n', 'g')<CR><CR>
" ctrl-l clears highlighting and syncs diff
nnoremap <C-L> :nohl<CR>:diffupdate<CR><C-L>
nnoremap <Space>w :w<CR>
nnoremap <Space>q :q<CR>
nnoremap <Space>e :e <C-D>
nnoremap <Space>b :b <Tab>
nnoremap <Space>d :bd<CR>
nnoremap <Space>t :tabnew<CR>
nnoremap <Space>s :set<Space>
nnoremap <Space>f :find <C-D>
nnoremap <Space>m :make <Up>
nnoremap <Space>g :grep<Space>
nnoremap <Space>o :copen<CR>
nnoremap <Space>c :cclose<CR>
nnoremap <Space>n :cnext<CR>
nnoremap <Space>p :cprev<CR>
nnoremap <Space>x :new $HOME/.scratch<CR>
nnoremap <Space><CR> :!<Up>
" git diff current file
nnoremap <Space>D :vnew<CR>
\:setl bt=nofile bh=wipe<CR>
\:r !git show HEAD:#<CR>:1d _<CR>
\:diffthis<CR><C-W>p:diffthis<CR>
" git blame current file
nnoremap <Space>B zz:vnew<CR>
\:setl bt=nofile bh=wipe nowrap<CR>
\:r !git blame #<CR>:1d _<CR>
\:exe line('.', bufwinid('#'))<CR>zz
" git log current file
nnoremap <Space>L :tabnew<CR>
\:setl bt=nofile bh=wipe ft=gitcommit<CR>
\:r !git log -p #<CR>:1d _<CR>
" git show object under cursor
nnoremap <Space>O "xyiw:tabnew<CR>
\:setl bt=nofile bh=wipe ft=gitcommit<CR>
\:r !git show <C-R>x<CR>:1d _<CR>
" git status in quickfix list
nnoremap <Space>S :cexpr system("git status -s -uall
\ \| sed '/^ D/d'")<CR>
runtime! ftplugin/man.vim
packadd! editorconfig
colorscheme slate