summaryrefslogtreecommitdiff
path: root/config/vim/vimrc
blob: 0e37dc304f9273c7fb1afa3dff0c5ac1a044e072 (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
set viminfo+=n~/.config/vim/viminfo
set runtimepath+=~/.config/vim,~/.config/vim/after
set autoindent
set wrap
set linebreak
set mouse=a 
set autowrite

set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab

set nocompatible

set spelllang=en_gb

set number relativenumber

syntax on

nnoremap <silent> <C-l> :nohl<CR><C-l>

inoremap { {}<ESC>ha
inoremap [ []<ESC>ha
inoremap " ""<ESC>ha
inoremap ( ()<ESC>ha

inoremap <C-space> <C-n>


nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

nnoremap <F9> :w<Enter>:!chmod<Space>+x<Space>"%:p"<Enter>:!"%:p"<Enter>

set foldmethod=syntax
set foldlevel=99
set conceallevel=2

call plug#begin()

Plug 'preservim/nerdtree'
nnoremap <F5> :NERDTree<CR>

Plug 'preservim/vim-markdown'
"let g:vim_markdown_math = 1
"let g:vim_markdown_frontmatter = 1
"let g:vim_markdown_toml_frontmatter = 1
"let g:vim_markdown_json_frontmatter = 1


Plug 'neoclide/coc.nvim'
hi CocInlayHint ctermbg=Black ctermfg=Gray

set updatetime=300
set signcolumn=yes

nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

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)

xmap <leader>f  <Plug>(coc-format-selected)
nmap <leader>f  <Plug>(coc-format-selected)

nmap <leader>rn <Plug>(coc-rename)
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
xmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)
" nmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)

"inoremap <silent><expr> <TAB>
"      \ coc#pum#visible() ? coc#pum#next(1) :
"      \ CheckBackspace() ? "\<Tab>" :
"      \ coc#refresh()
"inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

"inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction


if has('nvim')
  inoremap <silent><expr> <c-space> coc#refresh()
else
  inoremap <silent><expr> <c-@> coc#refresh()
endif

xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" autocmd CursorHold * silent call CocActionAsync('highlight')

function! ShowDocumentation()
  if CocAction('hasProvider', 'hover')
    call CocActionAsync('doHover')
  else
    call feedkeys('K', 'in')
  endif
endfunction

autocmd FileType python let b:coc_root_patterns = ['.git', '.env', '.']

Plug 'junegunn/fzf.vim'

nnoremap <F6> :Files<CR>
nnoremap <F7> :Rg<CR>


Plug 'heavenshell/vim-pydocstring', { 'do': 'make install', 'for': 'python' }

Plug 'tpope/vim-fugitive'

call plug#end()

highlight Pmenu ctermbg=black guibg=black ctermfg=white

hi TrailingWhitespace ctermbg=red guibg=red
call matchadd("TrailingWhitespace", '\v\s+$')