aboutsummaryrefslogtreecommitdiffstats
path: root/.vimrc
blob: 9d2de5a20c5964ca7ce47e6d93ca7b0f47a09293 (plain) (blame)
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
set nocompatible
set secure
set nomodeline

augroup vimrc
	autocmd!
augroup END

filetype plugin indent on

" Built-in plugins
silent! packadd! matchit
silent! packadd! editorconfig " Vim 9.1
silent! packadd! comment " Vim 9.1.?

runtime! ftplugin/man.vim

silent! syntax enable
set termguicolors
color halation

set shortmess+=I  " No intro message on startup.
set encoding=utf-8

set nowrap
set textwidth=79
set colorcolumn=80

" See :h fo-table.
set formatoptions+=cqnl1j

set wildmode=longest:full,full
set wildmenu
set wildoptions=pum,fuzzy
set wildignore=*.o,*.obj,*.pyc,*/node_modules/*,*/.git/*,*/build/*

set autoindent
set smarttab
set ignorecase
set smartcase
set autoread
set incsearch
set nohlsearch
set ttimeoutlen=100
set splitright
set splitbelow
set nojoinspaces
set noshowcmd

set foldmethod=syntax
setlocal foldlevelstart=99
setlocal foldlevel=99

" Store swapfiles in ~/tmp/vim.
if !isdirectory($HOME . "/tmp/vim")
	call mkdir($HOME . "/tmp/vim", "p")
endif
set directory=$HOME/tmp/vim

" Filetypes for file extensions
autocmd vimrc BufRead,BufNewFile .gitignore set filetype=conf
autocmd vimrc BufRead,BufNewFile Jenkinsfile set filetype=groovy

map <leader>e :Explore<cr>
map <leader>s :Sexplore<cr>
map <leader>v :Vexplore<cr>
let g:netrw_banner = 0  " Hide banner.

" Don't save netrw directory history (and thus don't create .netrwhist).
let g:netrw_dirhistmax = 0

" Toggle paste mode.
noremap <leader>p :set paste! paste?<CR>

" In Insert mode, press Ctrl-F to make the word before the cursor uppercase.
inoremap <C-F> <Esc>gUiw`]a

if executable("rg")
	set grepprg=rg\ --vimgrep\ $*
else
	set grepprg=grep\ -rIn\ $*\ /dev/null
endif

" Treat .h files as C, not C++.
let g:c_syntax_for_h = 1

" Disable error highlighting on C99 compound literals.
let c_no_curly_error = 1

let g:ale_set_signs = 0
let g:ale_virtualtext_cursor = 'disabled'
let g:ale_linters =
	\ {
	\ 'python': ['flake8', 'mypy'],
	\ 'c': ['cc']
	\ }

let g:EditorConfig_max_line_indicator = "none"

" CtrlP
let g:ctrlp_map = '<leader>f'
noremap <leader>c :CtrlPClearCache<CR>
let g:ctrlp_custom_ignore = '\v.+\.(gcda|gcno)$'
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'

autocmd BufNewFile,BufRead muttrc,.muttrc :set ft=conf