-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
124 lines (100 loc) · 2.87 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
" make Vim more useful
set nocompatible
execute pathogen#infect()
filetype plugin on
set encoding=utf-8 nobomb
set ffs=unix,dos,mac
set hlsearch
set title
set number
syntax on
" indentation
set tabstop=4
set noet
set shiftwidth=4
set autoindent
set si
set lbr
set tw=500
" Linux kernel coding style
"set tabstop=8
"set softtabstop=8
"set shiftwidth=8
"set noexpandtab
set background=dark
colorscheme goldenrod
set wildmenu
set laststatus=2
set t_Co=256
set autoread
" open help vertically
command! -nargs=* -complete=help Help vertical belowright help <args>
autocmd FileType help wincmd L
" centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" don’t create backups when editing files in certain directories
set backupskip=/tmp/*,/private/tmp/*
" don’t show the intro message when starting Vim
set shortmess=atI
" show the current mode (already on airline)
set noshowmode
" enable mouse in all modes
set mouse=a
" save with sudo
command W w !sudo tee % > /dev/null
" Filetypes (PKGBUILD, Go, Git, Python)
autocmd FileType for PKGBUILD set expandtab shiftwidth=2 softtabstop=4
autocmd FileType go set noexpandtab
autocmd Filetype gitcommit setlocal textwidth=72
autocmd Filetype py set expandtab autoindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79
" PKGBUILD
augroup pkgbuild
autocmd!
autocmd BufRead,BufNewFile PKGBUILD set filetype=PKGBUILD
augroup END
" vim-go
let g:go_disable_autoinstall = 1
let g:go_fmt_autosave = 1
set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
let g:go_fmt_fail_silently = 0
let g:go_fmt_command = "goimports"
let g:go_autodetect_gopath = 1
let g:go_term_enabled = 1
let g:go_snippet_engine = "neosnippet"
let g:go_highlight_space_tab_error = 0
let g:go_highlight_array_whitespace_error = 0
let g:go_highlight_trailing_whitespace_error = 0
let g:go_highlight_extra_types = 0
let g:go_highlight_operators = 0
let g:go_highlight_build_constraints = 1
" lightline
let g:lightline = {
\ 'colorscheme': 'landscape',
\ }
" indent guides
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg = red ctermbg = 3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg = green ctermbg = 4
" committia
let g:committia_hooks = {}
function! g:committia_hooks.edit_open(info)
" Additional settings
setlocal spell
" If no commit message, start with insert mode
if a:info.vcs ==# 'git' && getline(1) ==# ''
startinsert
end
" Scroll the diff window from insert mode
" Map <C-n> and <C-p>
imap <buffer><C-n> <Plug>(committia-scroll-diff-down-half)
imap <buffer><C-p> <Plug>(committia-scroll-diff-up-half)
endfunction
" vim-fugitive
nnoremap <leader>ga :Git add %:p<CR><CR>
nnoremap <leader>gs :Gstatus<CR>
nnoremap <leader>gp :Gpush<CR>
vnoremap <leader>gb :Gblame<CR>