-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
150 lines (120 loc) · 3.91 KB
/
init.vim
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
" PLEASE NOTE: This file is deprecated, my current nvim config is in a
" separate repo, this one remains for reference
let mapleader =" "
call plug#begin('~/.config/nvim/plugged')
" Rust
Plug 'rust-lang/rust.vim'
" Go
Plug 'fatih/vim-go'
" Javascript/react
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
" Misc
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'editorconfig/editorconfig-vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
call plug#end()
set bg=light
set mouse=a
set nohlsearch
set clipboard=unnamedplus
" Fix tabs
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
highlight LineNr ctermfg=grey
highlight CursorLineNr ctermfg=red
set nocompatible
filetype plugin on
syntax on
highlight Statement ctermfg=red cterm=bold
set encoding=utf-8
set number relativenumber
nmap ; :
nnoremap ;; ;
" Colours!
" Popups
highlight Pmenu ctermbg=0 ctermfg=4 guibg=grey
highlight PmenuSel ctermbg=0 ctermfg=1 guifg=#dddd00 guibg=#1f82cd
highlight PmenuSbar ctermbg=grey ctermfg=blue guibg=#d6d6d6
" Gutter
highlight SignColumn ctermbg=black
" Visual Mode
highlight Visual ctermbg=grey
" Buffer Navigation
noremap <Leader>b :buffers<CR>:buffer<Space>
noremap <Tab> :bn<CR>
noremap <Leader><Tab> :bp<CR>
noremap <Leader>d :bdelete<CR>
noremap <Leader>o :edit<Space>
noremap <Leader>h :set hidden<CR>
" Autoclosing
inoremap " ""<left>
inoremap ' ''<left>
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
inoremap {<CR> {<CR>}<ESC>O
inoremap {;<CR> {<CR>};<ESC>O
" C
set cinoptions+=:0 "stops indentation of case statements
" Rust.vim
let g:rustfmt_autosave = 1
" Vim Go
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_hgihlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
" Coc
set updatetime=100 "affects swp files too...
" Tab completion cycling
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Return completion confirmation
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Fzf
nnoremap <Leader>f :Files<Space>.<CR>
nnoremap <Leader>a :Ag<Space>
nnoremap <Leader>r :Rg<Space>
" Enable autocompletion:
set wildmode=longest,list,full
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Splits open at the bottom and right.
set splitbelow splitright
" Airline
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1
let g:airline_theme='monochrome'
let g:airline_solarized_bg='dark'
" Replace all is aliased to S.
nnoremap S :%s//gc<Left><Left><Left>
" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
vnoremap <C-c> "+y
map <C-p> "+P
" Automatically deletes all trailing whitespace on save.
autocmd BufWritePre * %s/\s\+$//e
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb %
" HTML commenting
noremap <Leader>hc I<!--<ESC>A--><ESC>
noremap <Leader>hu I<ESC>l4x$xxx