aboutsummaryrefslogtreecommitdiff
path: root/home/vimrc
blob: 488899e4826f12ef01761135c6ee87482636a80c (plain)
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
"
" vim-plug
"

call plug#begin('~/.vim/plugged')

Plug 'tpope/vim-sensible'
Plug 'justinmk/vim-dirvish'
Plug 'vim-scripts/bufexplorer.zip'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-eunuch'
Plug 'dense-analysis/ale'
Plug 'https://gitlab.com/protesilaos/tempus-themes-vim.git'

call plug#end()

"
" behavior
"

set nocompatible  " use vim, not vi settings
set wildignore=*.pyc,.git " ignore from autocomplete
set showcmd       " display incomplete commands
set ignorecase    " ignore case in search
set smartcase     " respect case in search if uppercase is used
set nowrap        " do not wrap lines
set vb t_vb=      " no beeping

"
" formatting
"

set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set shiftround
set listchars=tab:»·,trail:·
set list

"
" filetype-specific
"

if has("autocmd")
  au!

  " plain text
  au FileType text         setlocal tw=80
  au FileType markdown     setlocal tw=80

  " python
  au FileType python       setlocal ts=4 sw=4 sts=4

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  au BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif
endif

"
" bindings
"

let mapleader = ","

" convenience
nnoremap <leader>x :source ~/.vimrc<Enter>
nnoremap <leader><leader> <c-^>
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l

" dirvish
nnoremap <leader>e :Dirvish<Enter>

" bufexplore
nnoremap <leader>fe :BufExplorer<Enter>
nnoremap <leader>fs :BufExplorerHorizontalSplit<Enter>
nnoremap <leader>fv :BufExplorerVerticalSplit<Enter>

" ctrlp
let g:ctrlp_map ='<leader>a'

" ale
nnoremap <leader>r :ALEDetail<Enter>

"
" visual
"

set background=light
silent! colo tempus_dawn
let g:airline_theme='tempus_dawn'
set hlsearch
syntax enable

" don't mess up gutter highlight with gitgutter
highlight clear SignColumn
hi! link SignColumn Background

" Highlight non-ascii characters as the theme highlights errors
hi clear nonascii
hi link nonascii Error
if has("autocmd")
  au BufReadPost * syntax match nonascii /[^\d0-\d127]/
endif

" highlight trailing space and tab as the theme highlights errors
hi clear SpecialKey
hi link SpecialKey Error

let g:airline_powerline_fonts = 1
let g:airline_left_sep="\uE0B4"
let g:airline_right_sep = "\uE0B6"
let g:airline_skip_empty_sections = 1

"
" local additions
"

if filereadable($HOME."/.vimrc-local")
    source ~/.vimrc-local
endif