-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
160 lines (120 loc) · 3.54 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
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
152
153
154
155
156
157
158
159
160
" Unicode support for unrecognized locales
if has("multi_byte")
if &termencoding == ""
let termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,latin1
endif
if has('nvim')
let g:yoinkSavePersistently = 1
if exists('g:vscode')
" Keep undo/redo lists in sync with VSCode
nmap <silent> u <Cmd>call VSCodeNotify('undo')<CR>
nmap <silent> <C-r> <Cmd>call VSCodeNotify('redo')<CR>
nmap <silent> <C-f> <Cmd>call VSCodeNotify('actions.find')<CR>
endif
" Highlight yanked text
autocmd TextYankPost * silent! lua vim.hl.on_yank {higroup='Visual', timeout=300}
else
" Use mouse input
set ttymouse=xterm2
endif
if !exists("g:vscode") && !has("ide")
packadd vim-fugitive
packadd vim-airline
packadd vim-airline
" Airline setup
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_min_count = 2
let g:airline_skip_empty_sections = 1
"let g:airline_theme='base16_shell'
" vim/autoload/airline/themes/base16.vim, managed by flavours
let g:airline_theme='flavours'
" Slant separator
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:tmuxline_separators = {
\ 'left' : g:airline_left_sep,
\ 'left_alt': g:airline_left_alt_sep,
\ 'right' : g:airline_right_sep,
\ 'right_alt' : g:airline_right_alt_sep,
\ 'space' : ' '
\}
let g:tmuxline_preset = {
\ 'a': '#S',
\ 'win': ['#I', '#W'],
\ 'cwin': ['#I', '#W'],
\ 'z': '#H',
\ 'options': {
\'status-justify': 'left'
\}
\}
" Make vim's window separator match tmux
set fillchars+=vert:│
au User AirlineAfterInit,AirlineAfterTheme call FixSplitColours()
fun! FixSplitColours()
let l:termColour = g:airline#themes#{g:airline_theme}#palette['normal']['airline_a'][3]
exec 'hi VertSplit ctermfg=' . l:termColour . ' ctermbg=NONE cterm=NONE'
exec 'hi StatusLine ctermfg=' . l:termColour
exec 'hi StatusLineNC ctermfg=' . l:termColour
endfun
" https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f
function! MyHighlights() abort
highlight SpecialKey ctermbg=grey
endfunction
augroup MyColors
autocmd!
autocmd ColorScheme * call MyHighlights()
augroup END
" Color theme generated by flavours
colorscheme flavours
set termguicolors " this one makes text more grey-ish, FIXME
syntax on
set laststatus=2 " display statusline for every window
set mouse=a
" Line numbering
set number
set relativenumber
" Folding
set foldmethod=syntax " folds are appropriately created for supported languages
set nofoldenable " all folds open by default
" Allow saving of files as sudo when I forgot to start vim using sudoedit.
cnoremap w!! SudaWrite
endif
" Use system clipboard
set clipboard=unnamed,unnamedplus
" Tabs
set tabstop=4
set shiftwidth=4
set autoindent
set cindent cinkeys-=0#
filetype plugin indent on
" Show invisibles
set list
set showbreak=↪\
set listchars=tab:\│\ ,nbsp:␣,trail:·,extends:›,precedes:‹
" Scroll window before reaching edges
set scrolloff=7
" Ignore case while searching if entire search term is lowercase
set ignorecase
set smartcase
" vim-cutlass
" uses `x` as the new cutting operation. `dl` will also delete a single
" character
nnoremap x d
xnoremap x d
nnoremap xx dd
nnoremap X D
" ~ now accepts a motion
set tildeop
" Automatically insert comment leaders when creating a new line from a comment
set formatoptions+=ro/
set textwidth=100