-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
151 lines (113 loc) · 3.22 KB
/
vimrc
File metadata and controls
151 lines (113 loc) · 3.22 KB
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
scriptencoding utf-8
set encoding=utf-8
set nocompatible
"Set $VIMDIR to ~/.vim if unset
if empty($VIMDIR)
if has('nvim')
let $VIMDIR = glob('~/.config/nvim')
else
let $VIMDIR = glob('~/.vim')
end
else
let g:vimdir = $VIMDIR
end
"Install vimplug, if not present
if empty(glob($VIMDIR . '/autoload/plug.vim'))
silent !curl -fLo $VIMDIR/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call mkdir($VIMDIR . '/spell', 'p')
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
call plug#begin($VIMDIR . '/plugged')
"Well it's only sensible
Plug 'tpope/vim-sensible'
"Airline
Plug 'bling/vim-airline'
Plug 'powerline/fonts', { 'dir': $VIMDIR . '/fonts/powerline', 'do': './install.sh' }
Plug 'vim-airline/vim-airline-themes'
"Automatic syntax checking
Plug 'dense-analysis/ale'
"Puppet
Plug 'rodjek/vim-puppet', { 'for': 'puppet' }
let g:puppet_align_hashes = 0
"Go
Plug 'fatih/vim-go'
let g:go_gopls_enabled = 0
"Color schemes
Plug 'tomasr/molokai'
call plug#end()
" Allow unsaved changes in buffers
set hidden
set ignorecase
set smartcase
set hlsearch
set visualbell
syntax on
" if has("gui_running")... else
colorscheme desert
let g:airline_theme = 'term'
set nocursorline
set backupdir^=$VIMDIR/backup
set directory^=$VIMDIR/tmp
if version >= 703
set undodir^=$VIMDIR/undo
endif
set expandtab
set cindent
set shiftwidth=2
set tabstop=2
"Python pep-008
autocmd Filetype python setlocal ts=4 sw=4 sts=0 expandtab
let g:ale_python_flake8_options='--ignore=E501'
"Puppetlint ignores
let g:ale_puppet_puppetlint_options='--no-puppet_url_without_modules-check --no-autoloader_layout-check'
"Shellcheck disable realtive check
let g:ale_shellcheck_options='-e SC1091'
"Yamllint disables
let g:ale_yaml_yamllint_options='disable-line'
set listchars=tab:→\ ,trail:·,extends:<,precedes:>,nbsp:␣
set list
set wrap
set foldmethod=syntax
set nofoldenable
set wildmode=longest,full
let g:is_posix = 1
"Ruby stuff
autocmd FileType ruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby let g:rubycomplete_rails = 1
autocmd FileType ruby let g:rubycomplete_classes_in_global = 1
" Go stuff
autocmd FileType go set nolist
autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
autocmd FileType go nmap <Leader>i <Plug>(go-imports)
" Fix auto comment for new lines etc
set formatoptions-=c formatoptions-=r formatoptions-=o
let mapleader=','
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>ew :e %%
map <leader>es :sp %%
map <leader>ev :vsp %%
map <leader>et :tabe %%
map <leader>d :e .<CR>
map <leader>c :tab split<CR>
map <leader>rc <Esc>:tabe $VIMDIR/.vimrc<CR>
" Disable EX mode
nnoremap Q <nop>
" map _ to remove search highlight
nnoremap <silent> _ :nohl<CR>
set splitright
" Make backspace work for insert
set backspace=indent,eol,start
"Spelling defaults
set spelllang=en_gb,da
autocmd BufRead,BufNewFile *.md setlocal spell
autocmd FileType gitcommit setlocal spell
" Better highilight colors
highlight SpellLocal ctermfg=253 ctermbg=2
highlight SpellCap ctermfg=0
highlight SpellBad ctermfg=249
" Use special colorscheme for diffs
if &diff
colorscheme molokai
endif
" Too old to use the mouse, both vim and nvim defaults to enabling mouse
set mouse=